For an extreme example, imagine a government paying millions for custom software (work for hire so the government ought to be the copyright holder)
"Work for hire" usually means employment in which case the copyright would automatically belong to the government if that was the employer.
More likely this will be a contract to create a product. It differs from "work for hire" because in one case you're buying someone's time and in the other you're buying a specific item. If the government contracts to buy a custom package and doesn't get ownership then unless there is specific political interference you'd have to blame the department's legal team who drew up the contract.