What are "rare earths"?
In the current periodic table the rare earths belong to the lanthanide group. They are the 15 elements with the atomic number 57 to 71 in the periodic table of elements. In total, they represent one seventh of all elements found in nature. Rare is therefore actually the wrong expression for it. They occur far more often.
Rare earths are not only needed for the production of magnets. They are also needed for the production of modern mobile phones/smart phones and laptops, as well as for the latest generation of flat screens. Samarium and cobalt are used for the production of magnetic materials with the highest energy product, as mentioned above. However, samarium is contained in the rare earths with a very small proportion. Samarium is also more expensive than neodymium, because the preparation with a high degree of purity is very complex compared to neodymium.
Neodymium on the other hand is more abundant than samarium. Easier to process and therefore cheaper to purchase.