Sometimes the specs are niche, so the thing is custom made, which expensive to do. However, lowest bidder wins, so they buy the one that is custom made to meet the required spec, but they cut the corner on everything else.
Take something like a boot. You can buy decent boots for $50 or great boots for $100 but if you're climbing Everest you will want the $200 boots that have X feature and are made well from a reputable company.
If you're the military, you want the X feature but not the colour that is available commercially nor the sole that is quite niche and so can be tracked and identified. So you out out a custom spec. Generic sole pattern, feature X. You want 500. Companies bid, offering it at 150. You buy it. Turns out the sole was different for a reason. The generic sole is dogshit. Boots are crap. You buy 5000 more.