You are forgetting the opportunity cost. The gold does not generate wealth it just stores value, like a mattress stuffed with bills. It has become a dead, stagnant, and unproductive thing and by doing that it has removed value from the overall economy that was previously there.
How? The money that was used to buy it is now in the hands of somebody else that can invest it. Nothing was lost. It just changed hands.