The problem at a fundamental level.... is Continual Flame.
Or put another way, the issue is less about the accumulation of coin than it is the accumulation of wealth. In actual medieval societies, the vast majority of things are degradable. The servants...die. Livestock....die. Your crops...die or are consumed. Most things produced require an incredible amount of effort just to maintain year to year and generation to generation.
So the wealth is in the permanent stuff, the land being the principal one (and the buildings on them). When you have land you have wealth, because the land is there generation after generation, the key to production. And land is limited, there is only so much of it, so it you have an innate supply and demand constraint. Everyone wants land, very few people get to have it, and those are the wealthy people for the most part.
Magic use in itself is just another form of labor....skilled labor to be sure...but labor nonetheless. Magic users have to be trained, they have a certain amount of productivity, most of them probably never amount to beyond 1-2nd level spells at most...and then eventually they die. Its an important and powerful resource....but still a limited one at an economy level. Now if magic is easy to learn...then schools and education programs can markedly increase that resource. But dnd suggests that spellcasting is just really hard to do, and it takes a certain person above and beyond the base intellect to really get the hang of it. So again, a limited resource.
But once you get into magic items...its a brand new ballgame, continual flame being the most basic example. Now we take a consumable labor resource and convert their time into generating a permanent magical benefit. That is not just a resource...that is WEALTH. That is a benefit that can be cultivated, stored, and built over time. A community starts with a handful of continual lights. Fast forward a generation....and the entire city is fully illuminated.
Permanent Magic items shatter the feudal economies that dnd would seem to simulate at first glance. Therefore, your first step to making an economy realistic....permanent magic items have to go. Either they are gone gone, or they require expensive recharging periodically, they fade to nothingness after X amount of time...etc.
Alright so the first hurdle I mentioned is above, lets go to the next step.
Lets assume that we have built a decent economic model for a small city. Prices are reasonable for what such a city needs to conduct its business. Now we insert a group of 5th-6th level adventurers. Not crazy high level, but certainly with access to a host of powerful items and potentially a lot of money. How does that impact the economy?
We can look at a few ideas:
1) Adventuring is a short-time lucrative gig. In this model, raiding a dungeon or taking out a dragon is quite lucrative....but the jobs are few and far between. One dungeon might set you up for a year compared to normal labor (for just a few days work), but you can't sustain yourself on that kind of work indefinitatey.
The problem with dnd adventures is many of them have a "and next....and next....and next" element to them. Downtime is limited, and so PCs are adventuring all the time. But if you adopt a model where adventuring is SUPER STRESSFUL and SUPER HARMFUL TO THE BODY....adventurers need breaks, lots of breaks. Its kind of like the modern day oil rig worker, who will often make a high end year salary with a 6 month rotation....but they aren't stinking rich. And people aren't going to hire them for another rotation immediately afterwards, you want rig workers that have time in between.
This model would have limited shock to an economy. Yeah adventurers get a massive payout, but that needs to last for a year, maybe more. So its not that much different than a skilled laborer who works hard all year for their money, but still makes roughly what an adventurer might make.
2) Adventuring doesn't generate much spendable money. Another idea is that the vast majority of things adventurers find in a dungeon or a hoard isn't that spendable. Art is one example, even high end jewels would be difficult to find a buyer for...you would likely need to go to the large cities for that kind of exchange.
Magic items....there is no magic item market, your not selling your items for coin unless the item would have high utility to a nobleman.
So this model requires a change in thinking for a DM, really shifting their treasures towards interesting (but not lucrative) items and curiosities rather than just raw bling.
That said, this model does kick the can a bit. Yes again this is unlikely to effect our small city economy we noted above (those places just don't have the kind of people that deal in art and jewels and the like so the PCs can't insert a bunch of money). But if we get a big city well than now we are back to PCs getting the ability to generate lots of gold quickly.
3) Your money isn't good here (aka the noble controlled society). One element of feudalistic societies that we have forgotten about in our modern economy. We hold to the tenent that "everyone's money is green", aka if you got the money I will sell the thing. But in feudalistic societies, the nobles have the wealth and money...and people would look with extreme suspicion upon non-noble people flinging around big cash. If a peasant tried to buy something with gold, the shopkeeper is likely to call the constable...as clearly they are a thief.
Most of the high end dealers work directly or are a part of teh nobles retinue. If an adventurer tries to buy or exchange something...they might feel inclined to report it to their lord first. And so if the PCs want to buy or exchange the cool stuff, they might need to roleplay in a few meetings at first, and everything is tilted in the lord's favor. No giving the peasants a ton of gold, etc.
This lets the PCs spend the big cash but in a controlled way, through an "overseer", and prevents the notions of paying a commoner 10 gp to pick up the dry cleaning that could "wreck economies".
alright that's a long enough posts, in the next one we can talk about disruptive magics to an economy