This doesn't happen in the corporate world (as much) because of various factors such as tax incentives and market pressures, but would be much more likely in the stately world of government IT.
A better solution would be license the code, such that it could not be used to provide public services unless the governing body contributed to a development association (either in money, code contributions, or some mixture thereof).