That's not a law, just a moderately recent convention: Milton Friedman in the 70s claimed that a company existed only for the good of its shareholders. And of course we've seen examples of this attitude from time immemorial.
But remember the famous 1950s quote from the then CEO of GM: "what was good for our country was good for General Motors, and vice versa.” People usually twist it around the other way and claim that the company was saying it was more important than the country, but that's not what Wilson said. He made that statement as part of a speech (congressional testimony IIRC) saying that business needed to serve society.