Part of me thinks that the government needs the freedom to fund research based on some somewhat subjective criteria.  Ultimately, you want to fund research that generates "good stuff".  So I think it is important that universities understand that grants from NIH or DOD or whoever aren't entitlements - you have to actually work for them.

Having said that, I think that Trump's use of these grants as a club to compel the universities to bend a knee to him is completely inappropriate.  Ditto for using these grants to compel the universities to abandon DEI initiatives.  That kind of thing should be backed by congressional action, not just the whim of the president.  So if Congress passed some laws saying you can't do DEI, then withholding grants to universities that didn't comply would be fine.  (Not necessarily fine as a moral issue, but fine as a legal issue.)