These days, it seems like companies are nickel-and-diming us to death. Want a pillow and blanket on your flight to the coast? That'll be $8 on some airlines. It can seem logical to extract every last ounce of available profit for the good of shareholders. But sometimes, forgoing some profits can make more sense.

Consider Google (Nasdaq: GOOG). The company with the "don't be evil" motto just announced that it will cover the extra expense its partnered gay and lesbian workers bear when their domestic-partner health benefits get taxed. (The tax doesn't apply to married heterosexual couples.) This will cost the company a few bucks, but it will also make Google a more attractive employer for current and prospective workers, and boost its reputation among those who care about this issue.

Voluntarily sacrificing profits to gain a larger benefit is nothing new. Henry Ford startled the world in 1914, when he more than doubled Ford (NYSE: F) workers' daily pay to $5, and shortened their work day by an hour, from nine hours to eight. This obviously cost a lot, but it also helped him develop a class of customers who could afford his automobiles. It also attracted gobs of workers, reduced turnover, and even led to greater efficiency, since Ford could now implement three eight-hour shifts. Being revolutionary in operations can sometimes lead to revolutionary profits.

Sometimes, doing good voluntarily will mainly boost your reputation, as it surely did for Wal-Mart (NYSE: WMT), Home Depot (NYSE: HD), and Lowe's (NYSE: LOW) in Louisiana, following Hurricane Katrina's devastation. The companies reportedly delivered more aid to the region than our government did via FEMA. Much of it, including pharmaceutical supplies, they offered for free. These companies sent in hundreds or thousands of truckloads of stuff, and were able to effectively use their knowledge of local infrastructure and supply chains to make a big impact.

Next time you hear about a company seemingly giving away money, think about what it might be getting in return. There's often more than a karmic payoff for doing the right thing -- companies that practice this sort of strategic generosity can make for great investments.

What companies have voluntarily done the right thing -- and what did that get them? Share your favorites by leaving a comment below!