WHEATON, Md.—When federal lawmakers wrote the act overhauling the nation’s health-care system six years ago, they ruled out any possibility of extending health insurance to illegal immigrants.

Local officials where many of those immigrants live are treating them anyway.

A Wall Street Journal survey of the 25 U.S. counties with the largest...