It makes sense to buy "off-the-shelf" or "out of the box" software in a well-understood domain with a healthy competitive market.
But I often encountered organisations who would say "our preference is for off-the shelf" or even "our policy is off the shelf unless there is no product in the market."
The problem is that there are domains that aren't well-explored and don't have big markets of products. There are lots of these in government because every jurisdiction has different laws and regulations, practices and customs, and the software has to comply. And also the number of customers isn't very big. There are hundreds of tax departments perhaps, compared to many millions of web sites that need a CMS.
What happens is vendors try to show how they are complying with the off-the-shelf policy by claiming their product needs little modification to do the job. And often, this... isn't really true. The incentives align here. Procurement folks want to see policy followed and pursue an ostensibly low-risk option. Sales folks want to make the sale. Governments have deep pockets and tend to keep paying to get the job done, and vendors usually find ways to show that needed changes require more money, thanks.
There are other factors in play: in a small country like New Zealand certain vendors dominate more. In the US a vendor that's 5% of the market still has hundreds of customers and reference sites and users who can talk to each other, in NZ that would mean just one customer... since people like peer support when they buy scary new software that means the NZ market is nearly closed to smaller vendors.
So we see the same few products from the same few vendors used across govt. Sometimes those choices are good - if you can quickly spin up a solution with small changes it makes sense, especially if you have teams who already understand the base product. The bigger the project, it seems to me the less likely it is this will be the case.
https://www.rnz.co.nz/news/national/505234/government-births-deaths-and-marriages-it-project-halted