The biggest allocation went to Arizona State University, which got $63.5 million.

But Harvard’s allocation generated withering criticism on social media and among Republican politicians this week because of its large endowment — $40.9 billion as of June. Critics said it was unseemly for such a wealthy university to be getting taxpayer money when 22 million people had recently joined the unemployment rolls.

Even some alumni were displeased. Danielle Leonard, a lawyer in San Francisco who graduated from Harvard, said the university had many options other than taking public money.

“Just because the law was written to make the money available does not mean it was moral to take it,” she said, adding that the school has many other ways, including through loans, to support students and pay employees and staff members. Harvard “does not need a grant of public funds to do that,” she added.

The criticism came at the same time that several large national chains received money from a different part of the stimulus package meant to provide loans to small businesses. They included the restaurant chain Shake Shack, which said this week it would return $10 million it had received from the program.

When a reporter asked Mr. Trump and Treasury Secretary Steven Mnuchin on Tuesday about the loans, Mr. Trump replied with his statements about Harvard returning the federal relief money.

The university said that Mr. Trump appeared to misunderstand the source of the funds it was slated to receive.

“Harvard did not apply for, nor has it received any funds through the U.S. Small Business Administration’s Paycheck Protection Program for small businesses,” said Jason Newton, a Harvard spokesman. “Reports saying otherwise are inaccurate. President Trump is right that it would not have been appropriate for our institution to receive funds that were designated for struggling small businesses.”