A lot of that happens because the government provides the contractors with an endless stream of money and refuses to use the accountability mechanisms in the contracts when they mismanage their tasks.
As a currently popular example, most of the contracts around SLS, with Boeing and other companies, are like this. They consistently mess up, have quality and speed issues and overrun costs, and the government never exercises the option to cut their profit share, even when the overruns reach several times the original agreed upon cost.