Congress has voted for an $867 billion farm bill with strong bipartisan support, spurred in part by pressure from farmers battered by President Trump’s trade war with China.

In a 386-47 vote, the House of Representatives Wednesday approved a bill which allocates billions of dollars in subsidies to American farmers, legalizes hemp, bolsters farmers markets and rejects stricter limits on food stamps pushed by House Republicans. President Trump is expected to soon sign it into law.

The Senate passed the legislation in an 87-to-13 vote on Tuesday.

Congressional negotiators said they faced demands to complete the bill from farmers and ranchers who have seen steep declines in commodities prices as a result of the trade dispute with China.

Deal to pass farm bill scraps House GOP plan for new food stamp work requirements

“The passage of the 2019 Farm Bill is good news because it provides a strong safety net for farmers and ranchers, who need the dependability and certainty this legislation affords," Agriculture Secretary Sonny Perdue said in a statement after the bill passed the House.

Still, the bill has faced criticism, including from conservative Republicans. Sen. Charles E. Grassley (R-Iowa), one of two farmers in the Senate and a member of the Agriculture Committee, voted against the package over its expansion of federal subsidies to more-distant relatives of farmers, such as cousins, nephews and nieces. Grassley joined eight other Republicans in opposing the measure, which was supported by every Senate Democrat.

“I’m very disappointed the conferees decided to expand the loopholes on farm subsidies,” Grassley said before the vote. “I’ve been trying to make sure the people who get the subsidies are real farmers. … I’ve been trying for three years, and it gets worse and worse and worse.”

Here’s what’s in the bill.

Cuts to food stamps are not in the bill. The most controversial element of the farm bill has been the different House and Senate approaches to food stamps, or the Supplemental Nutrition Assistance Program (SNAP).

The House Republicans’ farm bill would have forced states to impose work requirements for food stamps on older workers, those aged 49 to 59, as well as parents with children ages 6 to 12. According to an estimate by Mathematica Policy Research, those proposals would result in benefits cuts for up to 1.1 million households, although conservatives and Republicans contest those numbers.

The final version of the farm bill made none of those changes. The farm bill requires Democratic support to get the 60 votes it needs to pass the Senate, and those cuts are not in the final package, Roberts has confirmed.

Liberal groups have cheered the news. “The negotiators appear to have achieved a bipartisan compromise that maintains and modestly strengthens SNAP, ensuring that millions of struggling Americans will continue to be able to count on SNAP to help them put food on the table,” Robert Greenstein, president of the Center on Budget and Policy Priorities, a left-leaning think tank, said in a statement.

The bill includes SNAP revisions, although they won’t shrink individual benefits. The final bill does include several new changes to the SNAP program, though none will restrict families’ food stamp benefits, according to congressional aides.

The National Accuracy Clearinghouse would prevent individuals from receiving food stamp benefits in multiple states. The final farm bill also eliminates an awards program that gave states up to $48 million a year in federal funding for high performances related to program access and payment accuracy.

The projected savings from these changes will be plowed back into food banks and other nutrition assistance programs, aides said.

Congress is not binding the White House on food stamps. The Trump administration has signaled its intention to cut food stamps without approval from Congress, and the farm bill does not bind the White House’s hands, according to congressional aides. The Agriculture Department has already floated weakening the waivers it gives states to temporarily suspend some food-stamp work requirements.

Some expanded farm subsidies. The farm bill mirrors at least some provisions in the farm bill passed by House Republicans, expanding some federal agricultural subsidies to nieces, nephews and first cousins of farmers — even if those relatives do not directly work on the farm.

The Environmental Working Group, which tracks federal farm subsidies, has criticized this provision as a wasteful giveaway. Congressional Republicans argued the expansion would encourage more people to be involved in farming.

No additional impact on the deficit. At close to $1 trillion a year, the farm bill’s price tag is high. But the bill’s drafters used the baseline set by the Congressional Budget Office under existing spending levels of $867 billion over the next 10 years, meaning it will not increase the federal deficit from prior projections.

Provides permanent funding for farmers markets, local food programs. The final farm bill provides permanent funding for a number of programs Congress was funding on a temporary basis, five years at a time. These include: promotional funds for local farmers markets, research funds for organic farming, and money for organizations working to train the next generation of farmers at a time when experts have raised concerns about the aging of the industry.

The bill also provides permanent funding for veteran and minority farmers.

Conservation program preserved. The House Republican bill had proposed merging the Conservation Stewardship Program, which pays farmers to strengthen conservation efforts, into another branch of the Agriculture Department. The program will survive under the final version of the bill, aides said.

Legalizes hemp. The farm bill legalizes the production of hemp, a form of cannabis with lower THC levels than marijuana. Analysts told CNBC that hemp could grow into a $20 billion industry by 2022.

— Erica Werner contributed to this report.