They don't. Or, rather, they do, but no more or less than any other top-level domain (TLD). The fact that a site is a .gov or a .edu is irrelevant as far as the value of the links is concerned.
It's true that .gov sites tend to be more authoratitive, and are themsevles often the target of high-quality links. That will increase the value of any links to your site from the .gov site. But the fact that the domain happens to be a .gov is not itself of any value.
The same is true for .edu sites, but to a lesser extent, as these are often crammed with lower-quality postings from students.