The action capped a two-year undercover investigation of Allgyer and the club by the federal Food and Drug Administration.

In his opinion, Stengel discounted an arrangement by which a private group, Right to Choose Healthy Food’s Rawesome Club, was leasing Allgyer’s cows and distributing milk to Grassfed on The Hill members.

Buyers each paid a $25 fee to join the Rawesome Club, according to court papers.

But, Stengel wrote, such “cow sharing” transactions amounted to a “subterfuge” in which raw milk was taken out of state and left at a “drop point.”

Allgyer had urged the court to deny the summary judgment the FDA requested in December, saying his dealings with the Rawesome Club were private and not subject to FDA involvement.

Allgyer also argued that the action against him was “quasi-criminal” in nature and thus required the government to furnish probable cause and an official complaint.

Stengel disagreed, saying Allgyer’s actions were lawfully regulated as interstate commerce by the FDA, and that the farmer disputed none of the material facts of the case.

Under the injunction, Allgyer may continue to sell milk in Pennsylvania but must label his products with his name and that of his business, Rainbow Acres Farm.

He may ask the court to lift the injunction in five years.

Raw milk may be sold legally in Pennsylvania, but not in Maryland.

The government has long contended that the product can expose people to E. coli and other pathogens.