Depending on where you live, the source of those political ads cramming your mailbox may be hundreds of miles away.

Millions of dollars in outside money is pouring into two high-profile Assembly races in San Bernardino County, state records show.

Independent expenditure committees have spent more than $6.1 million in the 47th Assembly District race between incumbent Cheryl Brown and challenger Eloise Reyes. The race is unusual because both candidates are Democrats.

And at least $1 million has been spent by independent groups in the 40th Assembly district race between Assemblyman Marc Steinorth, R-Rancho Cucamonga, and challenger Abigail Medina, a Democrat.

Independent committees, which typically feature innocuous-sounding names and funding from a variety of donors, legally can’t coordinate activities with candidates. And unlike campaign donations, which are capped by state law, independent committees aren’t limited in what they can raise or spend.

So much money has flowed into the 47th District race that it’s third in spending by independent committees among all California Assembly and state Senate races, according to Rob Pyers of the California Target Book, which studies legislative contests. The 40th District came in 13th on the list.

The spending reflects a high level of outside interest and it shows how competitive those races are, since outside groups spend their money where they can have the most impact.

The Brown-Reyes contest features an intraparty matchup that’s symbolic of a larger fight between business groups and progressive activists in Sacramento. The 47th District includes part of the city of San Bernardino as well as Colton, Grand Terrace, Rialto and Fontana.

“One common denominator in those top-spending races, the majority are Democrat versus Democrat races. In those cases, it’s almost always between a moderate Democrat and a progressive,” Pyers said.

“With the GOP’s voter registration in the throes of a demographic death spiral in California, groups that in the past would have backed Republicans are seeing the writing on the wall and putting their weight behind candidates who will grow the ‘Moderate Dem’ caucus, and the internecine warfare is a natural consequence of the Democrats’ expanding tent,” he added.