I think the way this works is that Harvard accepts a lot of contracts from the Feds. Along with those contracts come clauses preventing discrimination in all things, great and small.
Harvard has a stark choice -- give up all government contracts or end discrimination. They are not going to give up the Federal sugar...
Harvard could easily give-up government contracts and go on discriminating if the wanted to. Their $40 billion endowment allows this.