The purpose of living in society has many goals. One of them is to work in such a way to improve what and how we improve so we can have more wealth. But there are plenty of other goals. Such as not destroy the environment. And most importantly, to make people in society happier.
A coal power plant is not allowed to use low grade highly polluting coal because even if its cheaper to do so, the outcomes for society are worse with it than forcing the power plant owners to spend more money on more expensive coal. Its a reasonable restriction on what inanimate resources can be used by a corporation.
A university should be made to have better parity between genders. It might lower the scientific productivity of the university - evidence needed. But not doing so has the negative societal outcome of making a lot of people very very unhappy. Affirmative action is a reasonable restriction on what human resources can be used by a corporation.