There are many more reasons for this then mentioned, including keeping more IT experts locally, better connections with academia, higher salaries for gov IT guys, less corruption etc.
The MAJOR thing is actually that gov companies and their systems are usually quite complex and not something that can be easily (or at all) correctly done by external team of any kind - you need to be there, on the spot, and live that system for years to know how to program it, improve it, and make it good for the country and its citizens. I worked for gov 15 years, and did many huge projects with various companies - IBM, Microsoft, Oracle, Cisco etc... almost all being complete garbage, especially for the usual multi billion price that is payed to those corps yearly. There is an illusion that big names mean big and qualified team, good responsibility delegation (there is the 'nobody got fired for choosing IBM' thing) and that high price means quality, but in practice it never works like that, reality is quite the opposite (except responsibility delegation/dispersion which is totally true).
The major reason that proprietary software is so prominent in gov is corruption.