Many times the government can’t hire employees they need (unable to pay them a competitive salary or otherwise attractive career prospects) so can’t bring it in house.
Then, cost-plus arises because a company has to cover overhead and leave a profit, otherwise why would they bother? (Cost plus makes sense when you’re not sure enough of the requirements to write a fixed-price contract and then get change-ordered to death.)