Well, it's not that simple. Yes, Congress passes the bill saying that X billions of dollars have to be spent on universities, but that bill does not name every single university in US as beneficiary. That's what executive branch is for: to work out the details of how to implement the law passed by Congress.
So, Trump taking money from Harvard and giving it to say, a community college in Tampa is technically still correct implementation of the law. I mean, it all depends if he can defend his decision in court, because of course he cannot discriminate based on race, ethnicity, political affiliation etc.