There are good examples of government IT infrastructure done right (e.g. https://e-estonia.com), but the economics is stacked against them in many ways.
It doesn't have to be bad, but it almost always is.