The state of Connecticut spends a lot of money supporting school districts, paying nearly 10 percent of the state budget in direct grants.

And each year cities and towns put up a fight at the Capitol to keep their share of funds.

The state’s educational cost sharing grants are paid based on a complicated formula that is intended to determine need.

The state also pays to build most schools, at least in part, but it varies the subsidies for each district. For districts with limited resources, the state gives a bigger subsidy.

But when it comes to teacher pensions, the system of payments is not so intentional.

Teacher pensions are based on a statewide formula – years of service times 2 percent times final salary – that doesn’t take district ability to pay into account.

Because wealthier districts tend to pay their teachers more, the state pays their teachers bigger pensions, reversing the way other state education subsidies work.

When a school district pays a teacher’s salary, they are only paying a portion of that salary’s true cost. The state ends up paying the other portion when the teacher retires.

While ECS grants make up 10 percent of the state budget, they are falling in proportion to the state budget. Teacher pension contributions, on the other hand, are nearly 4 percent of the state budget and growing.

Retired teachers from Danbury, the district with the highest average, get about $43,700 per year, according to data obtained from the Teachers’ Retirement Board. Portland’s retired teachers, at the bottom of the list, average $28,500.

Hamden is the median district with average payments of about $36,000.

The range is much more drastic when the state’s contribution in the form of pensions is compared to its direct contribution through ECS grants.

Westport gets 6.5 times as much for pensions as it does from ECS, while Griswold gets less than one-fifth its ECS grant in the form of pension payments.

Greenwich, Weston, New Canaan and Ridgefield all get more than five times as much from pensions as they do from ECS.

Greenwich is among the bottom third of ECS recipients, but with pension and ECS payments combined it is in the top third of recipients. Stamford moves from the middle to the top 15.

The biggest cities are not negatively affected by the pension subsidy because their ECS grants are so much larger. The losers are mostly small and rural districts: Oxford, Putnam, Lebanon, Thomaston, Thompson, East Haddam, Somers, Canton, East Hampton and Griswold.