coincidentally i spent much of monday investigating the answers to that question
supposedly magnesium costs about 25¢/kg as caustic-burned magnesia https://pubs.usgs.gov/myb/vol1/2018/myb1-2018-magnesium-comp..., but that includes lots of impurities, probably including lead; you wouldn't want to eat it
the cheapest reasonably food-grade source i've found is probably food-grade magnesium chloride for supplements; it's hard to tell how much you're getting because magnesium chloride exists in various hydration states
here in argentina it costs 3.6 dollars per kilogram, which works out to somewhere between 11 and 36 dollars per kilogram of magnesium
the carbonate, the dead-burned oxide, and the hydroxide are also sold by the kilogram as food supplements; they don't have the hydration problem, and the prices i came up with were respectively
- 20 dollars per kg of carbonate and thus 70 dollars per kg of magnesium
- 15 dollars per kg of dead-burned food-grade oxide and thus 24 dollars per kg of magnesium
- 23 dollars per kg of hydroxide and thus 54 dollars per kg of magnesium
other non-food-grade sources i found in my search included galvanic protection anodes for hot-water heaters (35–44 dollars per kg); magnesium sulfate for bath salts, laxative, or fertilizer (17 dollars per kg of magnesium for the fertilizer, 24 for the bath salts); dolomite as fertilizer (20 dollars per kg of magnesium); and magnesium carbonate chalk as exercise equipment (91 dollars per kg of magnesium)
(my reason for this search was for formulating carbon-neutral cements, not supplementing my dietary magnesium, so i'd be delighted to find a non-food-grade source that was closer to 24¢ than 24 dollars)
24 dollars per kg of the oxide is 2.4¢ per gram
the chloride is highly water-soluble (you have to store it in a hermetically sealed container to prevent deliquescence; i bought a kilogram hermetically sealing jar from the health food store) so it's very easy to add to food. unfortunately it makes the food taste like horse shit, or more precisely like chewing on rubber bands, because those magnesium ions are extremely bitter
the oxide and hydroxide are almost perfectly insoluble in water, and the carbonate nearly so, and consequently they will not make your food taste like an accident in a quinine factory. they're just a little chalky. stomach acid converts them to the chloride, which is why mylanta is largely magnesium hydroxide
the other thing to keep in mind, aside from disturbing your stomach acid homeostasis, is that magnesium is a laxative. mixing it with food instead of taking it by iteslf helps with this. however, you don't want to mix it with food which is a good source of phosphate, such as coca-cola or high-phytate plants like flaxseed or beans, because the magnesium phosphate thus produced in your stomach has basically zero bioavailability. it doesn't matter if the phytate gets broken down by cooking because what it gets broken down to is phosphate
the oxide brand is a local argentine thing called 'natural whey', so you won't be able to find it abroad https://articulo.mercadolibre.com.ar/MLA-1165077489-oxido-de...