The decision on Wednesday by US District Judge Allison Burroughs in Boston marks a major legal victory for Harvard as it seeks to cut a deal that could bring an end to the White House's multi-front conflict with the nation's oldest and richest university.
The Massachusetts-based school became a central focus of the administration's broad campaign to leverage federal funding to force change at US universities, which Trump says are gripped by anti-Semitic and "radical left" ideologies.
Among the earliest actions the administration took against Harvard was to cancel hundreds of grants awarded to university researchers on the grounds that the school failed to do enough to address harassment of Jewish students on its campus.
Harvard sued, arguing the Trump administration was retaliating against it in violation of its free-speech rights after it refused to meet officials' demands that it cede control over who it hires and who it teaches.
Burroughs, an appointee of Democratic President Barack Obama, said the Republican president was right to combat anti-Semitism and that Harvard was "wrong to tolerate hateful behaviour as long as it did".
But she said fighting anti-Semitism was not the administration's true aim and that officials wanted to pressure Harvard to accede to its demands in violation of its free-speech rights under the US Constitution's First Amendment.
She barred the administration from terminating or freezing any additional federal funding to Harvard and blocked it from continuing to withhold payment on existing grants or refusing to award new funding to the school in the future.
White House spokesperson Liz Huston in a statement called Burroughs an "activist Obama-appointed judge" and said Harvard "does not have a constitutional right to taxpayer dollars and remains ineligible for grants in the future".
"We will immediately move to appeal this egregious decision, and we are confident we will ultimately prevail in our efforts to hold Harvard accountable," she said.
Harvard President Alan Garber said in a message to the campus community the ruling "validates our arguments in defence of the University's academic freedom, critical scientific research, and the core principles of American higher education".
Garber did not mention the status of settlement talks with the administration, which Trump during a cabinet meeting last week said he wanted to see result in Harvard paying "nothing less than $500 million" as it had "been very bad".
He said that even as the school acknowledged the key principles Burroughs' ruling affirmed, Harvard was going to be "mindful of the changing landscape in which we seek to fulfill our mission".
Three other Ivy League schools have made deals with the administration, including Columbia University, which in July agreed to pay $US220 million ($A340 million) to restore federal research money that had been denied because of allegations the university allowed anti-Semitism to fester on campus.
As with Columbia, the Trump administration took actions against Harvard related to the pro-Palestinian protest movement that roiled its campus and other universities in the wake of the October 7, 2023, Hamas attack on Israel and Israel's war in Gaza.
Harvard has said it has taken steps to ensure its campus is welcoming to Jewish and Israeli students, who it acknowledges experienced "vicious and reprehensible" treatment following the onset of Israel's war in Gaza.