This is less true with vehicles, pencils, etc. It is particularly true with IT. I'm not very familiar with the huge weapons systems purchases -- those are probably subject to a lot of other factors since there are only a few firms who can compete.
Part of this is due to the general government skills shortage in IT, but more that the top IT people tend to remain in operational roles, vs. going over to contracting.
The problems happen at the requirements phase -- government asking for very specific terms which exclude functional products, e.g. specifying file formats, number and type of hardware, etc. Sometimes this is for integration with existing government equipment, but more often it is because whoever specified the contract doesn't understand the set of possible solutions. In a lot of cases, too, a 95% solution that is COTS (and thus has less schedule risk, lower cost, etc.) is superior to a 100% solution which has to be custom built.
They HAVE gotten a lot better at this in the 1990s and 2000s. Part of the problem is an essentially limitless budget.