Actually facebook gives quite a big deal of software back to the community: http://developers.facebook.com/opensource/
There are some really cool (and big!) tools like HipHop and an improved version of memcached, which benefit the OS community a lot!
Google does the same thing. GoogleWave for example is entirely open source.