Purification of metals through filtration and electromagnetic separation