Management has to act in shareholders' best interest. Management decisions cannot be self-serving at the expense of shareholders. Shareholders are a diverse bunch and can be interested in things besides pure profit, and companies can choose to maximize on those alternative dimensions.
The Supreme Court said as recently as 2016: "Modern corporate law does not require for-profit corporations to pursue profit at the expense of everything else, and many do not."[1]
From that same article, there's more:
"More to the point, corporate directors are protected from most interference when it comes to running their business by a doctrine known as the business judgment rule. It says, in brief, that so long as a board of directors is not tainted by personal conflicts of interest and makes a reasonable effort to stay informed, courts will not second-guess the board’s decisions about what is best for the company — even when those decisions predictably reduce profits or share price."
1. https://www.nytimes.com/roomfordebate/2015/04/16/what-are-co...