We've had this discussion loads of times before, and the answer is the same as it has been since it was first asked some time back in the seventeenth century – it makes no difference whether the site you get a link from is a .gov, .edu, .net, .com, .info or anything else. The TLD a site uses – with the exception of country-specific domains – has no bearing at all on Google's opinion of the site.
If a site has a good reputation and authority, links from it will be valuable. But that also means that you're going to struggle to get links from it, because they won't be giving them out willy-nilly – and that is more true for government sites than any other. If a site is giving out links left, right and centre then the chances are that Google will pay near-enough no attention to those links.
Artificially seeking out .gov and .edu domains to plant your spam seeds when your site has no legitimate reason to have links from government departments or education institutions is not going to help you one iota.