NEW YORK, March 11 (Reuters) - Walgreens has settled charges by New York Attorney General Letitia James that it grossly inflated prices on at least 20 infant formula products after a recall by Abbott Labs led to a nationwide shortage in early 2022.

The largest U.S. pharmacy chain did not admit or deny wrongdoing in entering an assurance of discontinuance with James' office, including a $50,000 payment covering civil penalties and costs, that was made public on Monday.

James said Walgreens raised prices on the 20 products, including Abbott's Similac and Reckitt Benckiser's Enfamil, by 10% or more following the February 2022 recall, and in at least one case boosted formula prices by more than 70%.

Walgreens allegedly sold more than 3,400 cans or bottles or formula at the "unconscionably" inflated prices.

Without admitting or denying wrongdoing, Walgreens agreed not to charge excessive prices on consumer goods and services vital and necessary to people's health and safety.

The Deerfield, Illinois-based company also agreed to donate 9,564 canisters of formula to benefit low-income New Yorkers with infant children.

Walgreens declined to comment.

"During the formula shortage, families were panicked and struggling about how to feed their babies," James said in a statement. "For Walgreens to take advantage of this crisis and jack up formula prices is not only illegal, but downright shameful.

"My office will not tolerate any company that attempts to price gouge our state's consumers," she added.

The settlement was effective as of March 7, and signed by a Walgreens representative on Monday.

Abbott recalled its infant formula and closed its Sturgis, Michigan plant following reports that infants became sick after being fed formula that was produced there. The company reopened the plant that July. (Reporting by Jonathan Stempel in New York; Editing by Chris Reese and Stephen Coates)