“If federal prosecutors are engaged in legal action against those involved with medical marijuana in a state that has made it legal, then they are the ones who are the lawbreakers,” Mr. Rohrabacher said.

Mr. Farr said, “For the feds to come in and take this hard-line approach in a state with years of experience in regulating medical marijuana is disruptive and disrespectful.”

The sponsors said they were planning how to renew the spending prohibition next year.

The amendment aside, federal prosecutions of state-approved dispensaries have declined sharply in the last two years, particularly since the Justice Department issued a nonbinding “guidance” to prosecutors in 2013. That guidance recommended against pursuing dispensaries, growers and patients who comply with state law, have no links to cartels or interstate smuggling, and do not sell to minors.

New raids on state-approved dispensaries have largely ended, said Steph Sherer, executive director of Americans for Safe Access, a private group that lobbied for the December amendment.

At the same time, she said, federal prosecutors have relentlessly pursued existing cases like Mr. Lynch’s and an effort to shut down the large Harborside dispensary in Oakland, Calif. Unbridgeable policy conflicts remain; two of Mr. Lynch’s five felony counts were for selling to customers who were over 18, as California permits, but under 21, as federal law forbids.

At Mr. Lynch’s 2008 trial, even the term “medical marijuana” was largely forbidden, as was testimony about Mr. Lynch’s compliance with California law.

Mr. Lynch opened his business after a decade working in computer software, and he was doing well enough to buy a modest house with an ocean view. He felt excited to be “on the leading edge of a new industry,” he recalled the other day. He had a personal interest, too, having discovered that marijuana eased his severe migraines far better than prescription painkillers had.