No publicly traded company ever does things for purely altruistic reasons. Such things as you mentioned are done to boost public image, which in turn might increase profits. Just because they do them doesn't mean their being nice about it.
And not all companies are public. Shareholders might not even enter into it. If a "Mom n' Pop" operation wants to be environmentally sound or contribute to the community and still make a living, who's to tell them they shouldn't?
More to the point, though; I don't see why Dell is so bothered about this. Sure, Apple might not be as 'green' as they claim to be, but who really is?