Attorney General Kamala Harris' office filed the lawsuit on Tuesday in San Francisco Superior Court.
It claims retailers and candy makers exposed consumers to lead in violation of Proposition 65, which requires businesses to issue warnings about even minute amounts of chemicals deemed harmful by the state.
The attorney general's office says laboratory tests verified lead in the products, but the agency did not specify the amounts in the lawsuit or respond to a request seeking that information.
"Defendants ... have knowingly and intentionally exposed individuals within the state of California to lead," the lawsuit states.
The suit names other big retailers such as Target and dozens of other smaller companies and candy makers. Target did not immediately respond to a request for comment.
Under Proposition 65, a product that contains even small amounts of lead or other chemicals identified by the state as harmful to human health must carry a label warning consumers.
If found to be at fault by a judge, the candy makers and retailers could be fined up to $2,500 per day for each violation.
Lead exposure can damage the developing brains of children and lead to lower IQ.
While overall cases of lead poisoning have dropped in recent years, more than 500,000 U.S. children are still believed to have lead poisoning, according to the Centers for Disease Control and Prevention.
The primary sources for lead exposure to children in the U.S. are old paint, contaminated drinking water and soil tainted by old leaded gasoline, the CDC reported.
At Whole Foods, the suit named the market's "bulk ginger" and The Ginger People Baker's Cut Crystallized Ginger Chips as not complying with the law. The suit did not identify which company manufactured each specific product sold at each store.
Jennifer Marples, a spokeswoman for Whole Foods, said the company is investigating the issue with its vendors. She declined further comment.
At Trader Joe's, the suit names un-crystallized candied ginger.
Trader Joe's Co. spokeswoman Alison Mochizuki said the company does not comment on pending litigation.