The state’s smaller communities are feeling the pressure of sharply rising housing costs, stagnating wages, and an aging population.