If you want to know more about this, you can look into something called Phyromining, which is where they use hyperaccumulators to draw up certain metals from the plant, into the plant, then destroy the plant and collect the metals within. Certain metals like Zinc, Copper and Silver are readily absorbed because they are
water soluble, but for other metals like Gold, a application has to be made to make the gold water soluble in the soil, cyanide in particular. Being a sheep farm, I can readily make cyanide of
course, but am not too keen on the idea, so I might use a different type of lixiviant that would give me the same, but more safe results.
I was going to try this on my farm, but I have been so busy doing other things, that I was not able to try this yet.
But that is growing a crop to extract the metals. A farmer can do this to just rid their soil of heavy metals in the same way.