If the magnetic moment of an ion is electronic in origin, the inhomogeneous magnetic field separates ions with spin up from those with spin down. The effect of the Lorentz force is small due to the large ionic mass.