Actually in most cases doing the non-profitable thing is literally illegal for executives. At least in the US, CEOs often have a fiduciary obligation to the shareholders baked into their contracts. Granted they can always frame something as a loss leader or public outreach that will indirectly lead to long term profitability for the company, but they can never do charity for charity's sake.