I assume the money goes toward buying magical reagents and components. Newbie adventurers are always being sent on quests by powerful wizards-- you know, "I'll pay you 5000 gp to fetch me the left eye of an albino black dragon hatchling"? This time you're on the paying end, not the dragon-slaying end.
Without getting into the intracacies of realities TOO much, the idea above is very close to how it would be done. Let's use a simplistic example for arguments sake:
A wizard needs a 10,000 gold diamond for a certain magical item. First why is it worth 10,000? Yes diamonds are valuable, but not in and of themselves.
So let's follow the steps of this one diamond, and how it came to be worth 10000gp.
The mining company digs up the rough diamond material. As diamonds are difficult to find, it takes a long period of time in between each find. In the meantime the company needs to pay it's workers, buy equipment, pay engineers, probably clerics and wizards for spells and healing of injured workers, pay Warriors for protection from unknown dangers, etc, etc. So it's cost of finding that one diamond is probably around 2000gp.They charge the caravan who delivers the rough materials to town 3,000 for a 1000 profit.
The caravan needs to pay it's people, warriors for protection, possible a wizard or cleric, feed to horses, maintain the wagons, and pay possible border taxes. Alone these expenses could run to over 1000 gp a month. If the mine is far, then it will be very expensive. So let's say 1000gp is for expenses. The caravan will charge 5000gp to the jewelrer.
The jewelrer needs expensive tools, an excellent workshop with special lighting, maybe pay some goons for protection, possibly a wizard or cleric too and he might have an assistant or two, doing the day to day mundania of the shop. And the time spent working on that one diamond for say, two days. The jewelrer charges the merchant 7000gp, to cover his expenses, and make a tidy profit.
The merchant, he has a shop to run, or a wagon to haul, so he has expenses, maybe a bodyguard or two, probably expensive tastes, and runs a high markup due to the fine items he sells, so he charges 10,000gp to the wizard.
Thus the 10000 diamond. Not one person is getting that gold. By the time it is said and done, several dozen or a couple hundred people got a piece of that 10,000. The economy would not be overwhelmed, as the money is spread out all over the place.
The only problem is that the D&D money system is extremely out of realistic boundaries, due to the nature of the game. If every game ever played on one world, with all of it's treasures, weapons, magic, etc. etc. etc. were to be piled up, it would be insanely huge. probably in the trillions of gold pieces. The whole idea of the high value of everything seems to throw the money side out of wack.
The game is based upon the fact that the pc's will inherently come across vast amounts of money, or the game could not continue, for no one could afford to keep up with the game's expansiveness in level gains, and more powerful creatures, etc. And it is fantasy. If prices for some of the mundane items in the PHB were price like that in the historical medieval period, people would have starved. The average peasant may have seen( in game terms) probably 2-5 silver pieces a month. Hardly enough to eat on. A gold piece would be a treasure to these people.
Anyway, rest assured, the economy of any given world would never be destroyed by one adventuring party due to the vast amount of money they may spend, because that same vast amount of money was spent to get it into the adventurers hands, and everyone involved got a piece of the pie.
To put it into perspective, the United States has a GDP of roughly 24 trillion dollars. That means that 24 trillion dollars exchanged hands in 1 year in goods and services
in the United States alone. In no way does that amount of value ruin the economy, it keeps it going,
because everyone gets a piece of it. I won't get into the class warfare part of it, we all know how that its...