This is not totally accurate. For reference, here is the Wikipedia entry for Dodge v. Ford Motor Co. (1919) (copy and pasted at bottom). https://en.wikipedia.org/wiki/Dodge_v._Ford_Motor_Co.
In fact, the relatively new concept of a "public benefit corporation" is (at least in part) an effort to allow for-profit entities to pursue goals other than shareholder enrichment. However, some have criticized public benefit corporations as being entities that simply strengthen executive control at the expense of shareholders. https://en.wikipedia.org/wiki/Benefit_corporation
About Dodge v. Ford Motor Co.:
Dodge v. Ford Motor Co., 204 Mich 459; 170 NW 668 (1919),[1] is a case in which the Michigan Supreme Court held that Henry Ford had to operate the Ford Motor Company in the interests of its shareholders, rather than in a manner for the benefit of his employees or customers. It is often taught as affirming the principle of "shareholder primacy" in corporate America, although that teaching has received some criticism.[2][3] At the same time, the case affirmed the business judgment rule, leaving Ford an extremely wide latitude about how to run the company.[citation needed]
The general legal position today (except in Delaware, the jurisdiction where over half of all U.S. public companies are domiciled and where shareholder primacy is still upheld[4][5]) is that the business judgment that directors may exercise is expansive.[citation needed] Management decisions will not be challenged where one can point to any rational link to benefiting the corporation as a whole.
This doesn't contradict what I said. In fact it supports it. I said that the owners of the company are the ones who determine what it does. The shareholders are the owners. If the owners of the company want it to do a certain thing, and the directors do a certain thing, and it does that thing, no court is going to stop them. There is a rule that says that shareholders aren't allowed to try to screw over other shareholders, but I don't think "The other shareholders decided to pursue the public benefit rather than maximum profit" would quality.