The short answer is because it's usually a legal minefield, and there's usually little or no return on the investment a company would need to put in to the effort.
The source code and assets of a game are intellectual property. It isn't always true that all of the source code and assets are the property of a single development studio. For example, the studio may have licensed source code to some engine and made modifications to that code.
That means that the studio would need to identify and remove any source code or assets they do not have the license to redistribute or re-release. Similarly, they would need to vet the entire code base for references to trade secrets or other concepts that they are still bound by legal agreements to keep secret or contained. They'd probably want to scrape the source code for potentially offensive comments or references that may reflect poorly on the company.
That's a lot of work for a non-trivial code base, and that's still only presuming the legal ownership of the code is clear. In many cases with these sorts of games, the original IP holder is out of business or otherwise dissolved, and then you have the mess of who owns what of the remnants of the studio. This can be an extremely complex legal mess depending on how the studio went under and what the initial incorporation agreements were.
Given that, in these contexts, the games in question are usually no longer popular, it's unlikely a studio (or the postmortem IP holder) would see any kind of return on the investment necessary to clean up and solve all the legal and other issues with the code. Failure to properly vet all the outstanding intellectual property legalities in a source code release could result in the IP holder of some violated property filing a lawsuit or taking other legal action against the company, as well.
Of course, all that being said, there's another quite common reason that's relatively orthogonal to the legal issues: they just don't want to. Maybe they don't care, maybe they are hoping to re-use some of the code later in a re-vitalization of the original game, et cetera. It's their IP, they can choose how to distribute it. Or whether to distribute it at all.