The details of that probably haven't been settled by supreme court rulings, but the basic principle is that when a corporate entity says something, what's actually happening is that a person in the company is saying this thing, on the behalf of other people in that company, on behalf of, etc until you get to the shareholders. It's people all the way down, and people have rights. The same could be said of the government.
Note I'm a British Citizen, but the same basic legal principles apply over here, and have done for hundreds of years. I know there's a widely held conspiracy theory that this is all new, but jurists and legal scholars have been discussing and applying these principles for a very long time.