One of the nation’s largest egg producers has been accused by New York authorities of raking in $4 million in illegal revenue by gouging customers with exorbitantly high prices when the state was grappling with rising coronavirus cases.

A lawsuit filed Tuesday by Attorney General Letitia James of New York contends that the producer, Hillandale Farms, at times quadrupled the price of eggs to cash in on a surge in demand in March and April.

In particular, Hillandale targeted distributors in New York City, as well as the military installations at West Point, Fort Hamilton and Fort Drum, according to the lawsuit.

The company was not raising prices to offset increased costs, the suit says, but “simply to line its own pockets and profit off New Yorkers during a time of crisis.”

Officials at Hillandale were not immediately available to comment. They told the Attorney General’s Office that the company’s customers, which include supermarket chains, had agreed to its pricing practices.

According to the lawsuit, the Attorney General’s Office received hundreds of complaints from consumers angered by the sudden price increases.

“This location serves low-income families who, due to the current pandemic emergency, have most likely lost what little income they have,” wrote one complainant. “Disgraceful!”

The lawsuit is one of several accusing major egg producers of illegally taking advantage of heightened demand at a time when restaurants were shuttered and many Americans were forced to rely more heavily on home cooking.

In April, Texas’ attorney general accused the nation’s largest egg producer, Cal-Maine Foods, of hiking egg prices by 300%. Another price-gouging lawsuit, in California, named several major supermarket chains including Whole Foods and Costco.

The New York suit names Hillandale Farms Corp., which is headquartered in Kent, Ohio, as well as five other companies that use the Hillandale name.

Hillandale is often ranked among the top-five egg producers in the United States. It sells to several supermarket chains with stores in New York, including Stop & Shop, Western Beef, BJ’s Wholesale Club and Associated Supermarkets.

Between January and early March, Hillandale sold eggs to Western Beef at prices ranging from 59 cents to $1.10 a dozen. Then on March 15, two days after President Donald Trump declared a national emergency in response to the coronavirus, the lawsuit said Hillandale increased its price to $1.49.

The company continued to raise its wholesale prices as the pandemic grew in ferocity, to a peak of $2.93 a dozen by the end of March. The prices charged to Western Beef did not return to normal levels until early May, according to the lawsuit.

Other stores saw similar increases. At Stop & Shop, the price Hillandale charged jumped from as low as 85 cents a dozen in January to $3.15 by early April.

The lawsuit contends that Hillandale raised prices using a “feedback loop” system in which it coordinated with a market-research company, Urner Barry, to justify the price gouging.