Cities and towns emerge from state budget with hefty gains