When Reny Huelskamp, 34, and her husband Paul Huelskamp, 36, decided to move out of their San Francisco rental and buy their first home, they were drawn to Mill Valley, Calif., about 20 minutes from San Francisco. In May, they closed on a $2 million, roughly 2,000-square-foot house with a pool about a block from a lively town square.

“If you grab coffee at the coffee spot downtown, there’s a palpable sense of community,” said Mr. Huelskamp, a developer of solar and wind power plants. “You’ll see tons of young families, with...