Separation of rare earths from other elements by selective cation exchange