I know of many companies that learned about GitHub via open-source projects, which GitHub hosts for free, and decided that it was so good that they should pay money. Hosting such open-source projects was a brilliant marketing move.
Google Code, by contrast, didn't seem to have a clear purpose other than hosting open-source projects. It was a kind of souped-up SourceForge, rather than a serious GitHub competitor. Google certainly had the resources to improve it, but didn't have the motivation that GitHub did -- and we see the results.
I can't say that I'm mourning Google Code, and I think that the way in which they're sunsetting it is perfectly reasonable. But it demonstrates that free services are only going to stick around so long as it is serving another purpose, and that without such a purpose, you can't reasonably expect it to stick around.