Formaldehyde is readily dissolvable in water, but as said, unless the water table is high it is unlikely to rise into the rooting zone. Over time it would become very diluted if there were any water movement through the casket/body.
In any case, although the risk is low, the optics of the situation are probably more of an issue. Most wouldn't have an issue with it, but you might have a few who would be very upset by it. Best to avoid if possible in my opinion.