The tax subsidy for employer-sponsored health insurance is huge. Not only are the premiums exempt from income tax, they are also immune from Social Security payroll tax. The two subsidies combined will add more than $1.6 trillion to the deficit over the next five years alone.

But because that income is not included in the Social Security wage base, some workers also lose out on future retirement benefits. So what would happen if Congress repealed the exclusion for employer-sponsored insurance?

That question has a very complicated answer. The reason has a lot to do with those Social Security benefits, according to a new paper by the Urban Institute’s Karen Smith and my Tax Policy Center colleague Eric Toder.

Overall, the present value of those more generous Social Security benefits offsets some, but not all, of the higher taxes. But for some workers—especially those at lower incomes—those greater retirement benefits would more than compensate for their higher taxes.

Here’s why:

Taxing ESI moves three financial levers. Since employer-paid premiums would be treated like wages, most workers getting ESI would pay more in income, Medicare, and Social Security taxes. Those higher income and Medicare taxes would have no effect on their future Social Security benefits. But raising the wage subject to Social Security taxes would boost benefits for some retirees.

The story gets complicated because each of those taxes affects households in different ways. For example, very low income households who fall below the income tax threshold (about $19,000 for a childless couple) would not face higher income taxes but would pay more Social Security and Medicare taxes. At the other end of the income scale, workers earning more than about $117,000 in 2014 will have already maxed out on their Social Security tax so even if their ESI is included in income, they won’t pay any more of that levy. And since there is no wage cap and no floor on the Medicare tax, everyone would pay more of that levy.

All these crosscurrents would have important consequences, not just for family incomes, but also for federal deficits and the health of the Social Security trust fund.

Because most people paying higher taxes are not yet collecting Social Security, the federal budget deficit would decline by about 1.6 percent of Gross Domestic Product to start—roughly equal to the increase in federal receipts. But as those workers begin to retire and start collecting bigger benefits generated by their higher lifetime earnings, the net decline in the deficit would moderate and average 1.1 percent of GDP over the next half century.

Because higher payroll taxes would exceed benefit increases, taxing ESI also would improve the long-term health of the Social Security trust fund. However, it would not completely eliminate the account’s projected long-term deficit.

The effects of this trade-off between taxes and benefits would vary across and even within income groups. Overall, the present value of those higher Social Security benefits from including ESI in 2014 wages would offset only about 22 percent of the combined increase in payroll and income taxes. But it would compensate for about 72 percent of those higher Social Security taxes.

Since Social Security is progressive, workers in the lowest 20 percent of income would get a bit more in benefits then they’d lose in higher taxes. By contrast, households in the top five percent of income would recover only about one-third of their higher taxes in the form of bigger future Social Security benefits.

Over their lifetimes, all earnings groups would receive less in benefits than they pay in taxes. However, middle-income workers would face the largest tax increase as a share of their lifetime earnings. By contrast, low- and high-income workers would be hit by much smaller net tax rate hikes.

The bottom line: Eliminating the tax preference for employer-sponsored insurance would improve the government’s overall financial condition as well as the health of the Social Security trust fund. But the increase in Social Security benefits would affect different earnings groups in very complicated ways. And while the Social Security Trust Fund would be strengthened by higher payroll taxes, that improvement would be mitigated by an increase in benefits.

Posts and Comments are solely the opinion of the author and not that of the Tax Policy Center, Urban Institute, or Brookings Institution.