The obvious answer is to tell the players "there aren't magic item shops in this setting." The problem with that approach is that the players will eventually be dripping with magic items they don't care about, and yearning for magic items that they still haven't found.
They'll look for low-key magic item shops. "Hey, can we 'donate' these +1 maces and axes to the high temple of the sun god and ask the priests to forge me a magic glaive?"
So the second most obvious answer is to make magic item shops that don't resemble a JRPG or MMO. You create a red dragon that collects magic items, and will buy them from adventurers for gold (which she extorts from kings and merchants). You create a shadowy wizard that will sell knowledge (spells and scrolls) for gold to fund his secret experiments. You create a good-aligned temple that will forge blessed weapons and armor for those who demonstrate their faith (with deeds, yes, but also coin).
But you still haven't eliminated "Ye Olde Magic Item Shoppe." You've dressed it up to look a little bit like fantasy fiction, but it's still a transaction of magic items for coin and vice versa. Because the player activity is functionally the same (tallying coins, asking for prices, deciding how much to spend and what to sell), the fictional activity will largely feel the same.
The best solutionThe only way to eliminate "Ye Olde Magic Item Shoppe" is to give the PCs the magic items they want, and only the magic items they want.
The only reason a PC would want to sell a magic item is if that magic item isn't useful to them. That happens when you give out magic items because you wanted to equip your villains with them (but didn't think of the items' utility for the PCs) and when you give out magic items based on the random tables in the DMG. The only reason they would want to buy magic items is if they've got a lot of gold (happens a lot in 5e) and feel like the items they want should be available. Combined, the two factors really make players seek out magic item sellers:
"We have two +1 maces, a +2 sickle of evil, and a +1 heavy crossbow that none of us are using, and I still don't have a magic greatsword yet. Let's sell these useless things and get the +1 greatsword I need. +1 weapons seem common enough that someone must be selling one, or maybe I can get someone to forge me one."
Giving the PCs exactly what they want doesn't mean you have to be generous with magic items. You can be more stingy than usual with this technique and the players will probably be happier. Here's how you do it...
First, call for a wish list
Ask the players to submit a "wish list" of five magic items they want. Let them flip through the books like kids making their Christmas wish list from the toy store catalog. They can even make up their own magic items. If your campaign is going to be shorter or longer, ask for shorter or longer wish lists. A three-year level 1-20 campaign might call for six or seven per PC. A 10-session short campaign might only call for two per PC. If you're running an intentionally low-powered, low-level, short campaign, you might also want to limit the players to Uncommon and Rare items.
When you call for the wish list, show your players this article, so it's clear what you're doing. If you're transparent with the process, they can be more strategic with their choices. For instance, they might see value in asking for a Rare Flametongue greatsword and a Legendary Vorpal greatsword, so they get a middling-powered magic weapon early, and get an upgrade to a super-powered one much later in the game. They can always give the Flametongue to a henchman or beloved NPC.
From that, make a magic item treasure table
Combine the lists into one "treasure table" and arrange them from weakest to strongest. Always consider defense items to be stronger than offense items, because offense items are more fun (they speed up play and provide wow moments). This makes a list of 15-30 items.
Using the table, decide on some plot items
Some of your magic items shouldn't be random. Make plots and villains to contain the best items from the combined treasure table. Cross them off as you place them in the world. This probably cuts your list down to 10-20. The Lich King should wield the Staff of the Magi your wizard PC wished for. The Glabrezu should have the Holy Avenger sealed away in a trapped vault. The real nice Ioun Stone should be rumored to be at the top of the ruined tower of the mad mage, deep in a troll-haunted swamp. Don't write these adventures ahead of time. Just make sure to tell the PCs the legends of where they can find these items. It'll motivate them.
Then just use your table
When you give out treasure and a magic item should be in the hoard, choose or roll from the list. If you roll from the list, only roll 1d6 and count up from the bottom, skipping crossed off items, of course. When you give an item out, cross it off. The reason to use a smaller die than the list is that you want to give out more modest items first. It's only fair: PCs with more modest wishes get to use less powerful items longer (since they get them earlier). Plus, you don't want to drop a Staff of the Magi at level 1. I like to give out fewer, more powerful items, but that's going too far!
Tip: Since you're giving out fewer permanent magic items, consider giving out more consumable items -- especially consumable restorative magic items, like potions of healing, Keoghtom's ointment, potions of neutralize poison, scrolls of remove curse, and so forth. When you're giving out gold and mundane items, here's an inspirational, curated list of select interesting mundane items by value for you that will help give you a little inspiration.
Is "Ye Olde Magic Item Shoppe" really a problem?Not always.
I've claimed that D&D is its own subgenre of fantasy. It's a goofy power fantasy, and it can be a lot of fun to play up the... D&D-ness of it, even if you're playing Dungeon World or 13th Age or Pathfinder. So much of the D&D system intrudes into the fiction of the game world that D&D almost has to be its own genre. Daily refresh abilities, magic item tables, trap mechanics, Vancian casting, and encumbrance (and therefore henchmen) are system artifacts that create in-fiction shadows that have, over time, made their own culture -- their own fictional genre. And that's fun because it creates a culture and genre that's unique to our hobby.
This concept ties to the idea of "tone" or "mood" in your game. Setting the game's tone is a very important "session zero" task, and it's important for the whole group to work together to maintain the tone. The GM's role in setting and maintaining the tone is even more important. If you create a "Ye Olde Magic Item Shoppe" situation, you're saying something about the tone, and what you're saying is tied to images of moogles and Azeroth, and that can be awesome or jarring, depending on the tone you're going for.
|Image Credit: CC0 license from pixabay.com via pexels.com
So when you're running a very... "D&D" game (like I am right now), play it up! Make fun magic item shops run by crafty dragons and mad priests and shady wizards and extra-planar entrepreneurs.
But you might want to run a D&D game that's more like fantasy novels, movies, and TV shows. And that's fine too. That's when you need to use the techniques above to eliminate magic item shops.