So?Then you end up with a Dump Truck of Holding full of magic items that never get used.
Sell them. Or find-make-create uses for them. Or keep them as trophies over your castle* fireplace.
* - what? You don't have a castle? Maybe trade some unused magic items for one...
IMO ideally the DM neutrally places the items (or decides on the module with items already embedded) before even knowing which PCs will be in the adventure.The DM doesn't give the players what they want, they give them what they need. So, if the DM wants to discourage narrow builds and optimisation, such characters will find the dungeons devoid of items they can use, whereas the character with the sub-optimal build finds an ideally suited powerful item.