Supermarket giant Albertsons and its Vons stores will pay nearly $4 million to settle complaints in California that they overcharged consumers through false advertising and unfair competition. At the heart of the complaints were faulty scales and scanners used to determine food prices in checkout lines. Prosecutors from the offices of district attorneys in Riverside, Los Angeles, San Diego, Ventura, Alameda, Marin and Sonoma counties brought the civil law enforcement complaint against Albertsons Cos.

and Vons stores following a three-year investigation, which was settled this week. Also see: Biggest question from Kroger-Albertsons trials: What’s a grocery store? Overcharges at the supermarkets came to light when investigators with departments that handle weights and measures in the seven counties began working with law enforcement agencies. Consumers also raised concerns, according to authorities.

“When you get pricing wrong, it hurts a lot of people,” said Evan Goldsmith, deputy district attorney in Riverside County. “The way this worked was that if you grabbed a pound of bananas to get weighed, or any other produce sold, you’re going to get charged an inaccurate amount.” Albertsons spokeswoman Courtney Carranza did not immediately respond to questions Friday regarding the settlement.

More on supermarkets: Who is C&S Wholesale, potential buyer of 63 Albertsons stores in California? Goldsmith couldn’t explain how widespread the problem was in Riverside or Califo.