US District Judge Myong Joun granted the preliminary injunction sought by Democratic attorneys general from 20 states and the District of Columbia.
Joun, appointed by Democratic president Joe Biden to the federal court in Boston, said he would issue a memorandum explaining his decision at a later date.
Massachusetts Attorney General Andrea Joy Campbell celebrated the ruling in a post on her Bluesky social media account.
"These grants are a lifeline - I'll always fight to protect food assistance for families," she said.
Spokespersons for the justice and agriculture departments did not immediately respond to requests for comment.
Friday's ruling is one of several court decisions that have blocked the Trump administration's efforts to place new conditions on grants that would align funding with the Republican president's priorities.
The Democratic-led states and the capital district alleged Trump's new requirements would jeopardise funding already approved by Congress to feed low-income families and support farmers.
The states receive more than $US74 billion ($A105 billion) annually from the agriculture department.
At the end of 2025, the agriculture department said states must certify compliance with federal "policies" to receive funding.
The attorneys general alleged the department's requirement was too vague and would require them to comply with unrelated matters outlined in Trump executive orders concerning "gender ideology", immigration, transgender athletes and diversity, equity and inclusion.
The conditions could affect nutrition programs such as the Supplemental Nutrition Assistance Program, the anti-poverty food stamp program, the school lunch program and the Special Supplemental Nutrition Program for Women, Infants, and Children, the plaintiffs said.
They alleged the department lacked authority to impose the new conditions, which they say violate the US Constitution's Spending Clause and went into effect without going through required legal procedures.
The Trump administration contends that if states are required to abide by federal antidiscrimination laws and regulations to receive funds, it should also apply to other "policies".