“By passing this amendment, the Appropriations Committee is taking a critical step towards ensuring all Americans are protected by the Fourth Amendment — their mail, documents on their desks at home, and now their private emails,” said Representative Kevin Yoder, Republican of Kansas and one of the measure’s authors.

On June 19, the House voted 293 to 123 to prohibit the National Security Agency and C.I.A. from placing “backdoor” surveillance technologies on commercial technology products and to end warrantless collection of Americans’ online activities. That amendment, passed over the White House’s objections with a veto-proof margin, was written by Representative Thomas Massie, Republican of Kentucky and one of the House’s most outspoken libertarians, with the Democratic Representatives Zoe Lofgren, who represents Silicon Valley, and Rush D. Holt of New Jersey, a physicist.

Image Representative Dana Rohrabacher of California. Credit... Susan Walsh/Associated Press

An amendment by Representative Dave Reichert, Republican of Washington, reversed cuts to a Bill Clinton-era program that funds local police forces, a program long on the Republican target list. The liberal Democrat that Republicans love to hate, Representative Alan Grayson of Florida, convinced just enough Republicans to pass an amendment blocking the Justice Department from compelling journalists to divulge confidential sources. Another Democratic amendment clears a legal path for states to cultivate industrial hemp.

To be sure, Republicans note, plenty of amendments have driven spending bills to the right. Just last week, the House voted to block the Obama administration’s efforts to combat climate change on multiple fronts, including one amendment that prohibits any funding for any aspect of the administration’s “climate change agenda.”

Amendments also have passed to end the deferring of deportations of immigrants brought illegally to the country as children, to fund a Justice Department investigation of the Department of Homeland Security’s release of illegal immigrants and to block high-speed rail in California.

But, Mr. Massie said, the libertarian-liberal alliance is real and growing. He said he has been working with Ms. Lofgren on legislation that would repeal a federal law that makes it a felony to unlock a cellphone tied to a particular carrier, even after a contract is expired. Libertarians are also teaming with Democrats to change laws on federal mandatory minimum sentencing.