Skip to content

Tax railroad retirement benefits under IRC 86 and 72(r) and subtract them from state income - #10696

Open
MaxGhenis wants to merge 20 commits into
mainfrom
rrb-federal-tax
Open

MaxGhenis wants to merge 20 commits into
mainfrom
rrb-federal-tax

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

This PR builds on #10693. Until #10693 merges, GitHub also shows #10693's nine files in this diff.

What changes

After #10693, railroad_benefits counts in household and SPM income but in no tax. This PR splits the benefits into parts with different tax rules and taxes each part. It adds three person inputs:

  • railroad_social_security_equivalent_benefits: the social security equivalent benefit (SSEB) on Form RRB-1099, box 5.
  • taxable_railroad_pension_benefits: the rest of the annuity on Form RRB-1099-R (the non-social security equivalent part of tier 1, tier 2, vested dual benefits and supplemental annuities), less the employee contributions the annuitant recovers tax free.
  • tax_exempt_railroad_pension_benefits: that tax-free recovery.

railroad_benefits becomes their sum. If a user enters only the total, it counts in income totals but in no tax.

Federal

  • Under section 86(d)(1)(B) and (d)(4), the SSEB counts as a social security benefit. tax_unit_section_86_benefits and tax_unit_taxable_section_86_benefits run section 86 once on title II benefits and the SSEB together. taxable_social_security keeps the title II share, so the programs and states that read it see no railroad benefits. taxable_railroad_social_security_equivalent_benefits takes the SSEB's share, and a dependent's own return splits the same way.
  • Under section 72(r)(1), the rest of the annuity counts as a benefit from a section 401(a) plan, so taxable_railroad_pension_benefits joins gov.irs.gross_income.sources. Under section 72(r)(2), the tier 2 taxes employees paid count as employee contributions, which the annuitant recovers tax free.
  • medicaid_magi and aca_magi add back the nontaxable SSEB, as section 36B(d)(2)(B)(iii) requires for any benefit that counts as a social security benefit under section 86(d).
  • The calculations that recompute section 86 or build modified AGI around it now treat title II benefits and the SSEB alike. They include ira_219g_magi and ira_219g_taxable_social_security for the IRA deduction limit, taxable_ss_magi, the dependent IRA deduction and the tuition deduction cap. taxable_social_security_tier_1 (section 86's 50 percent tier) and tax_unit_taxable_social_security_pre_1993 run on both benefits and keep the title II share.
  • The model now reduces the section 22 amount by the head's and spouse's nontaxable SSEB and the tax-free part of the rest of their annuities. Section 22(c)(3)(A)(i)(II) requires the reduction for any pension or annuity "which is excluded from gross income and payable under ... the Railroad Retirement Act of 1974", and both amounts qualify. In its Schedule R instructions, the IRS has filers enter the nontaxable SSEB on line 13a. At line 13b, the IRS adds "Don't include amounts that are treated as a return of your cost of a pension or annuity," so a filer who follows the instructions leaves out the tax-free part. The model follows the statute, and this PR logs the conflict in source_conflicts/candidates.yaml as us:elderly-credit-railroad-tier-2-return-of-cost.

States

Under 45 U.S.C. 231m(a), no state, territory or the District of Columbia may subject a Railroad Retirement Act annuity to "any tax". taxable_railroad_benefits holds the Railroad Retirement Act benefits in the head's and spouse's federal AGI. The model builds income for 38 jurisdictions from federal gross income, AGI or taxable income, and now subtracts taxable_railroad_benefits in each: AZ, CA, CO, CT, DC, DE, GA, HI, IA, ID, IL, IN, KS, KY, LA, MA, MD, ME, MI, MN, MO, MT, NC, ND, NE, NM, NY, OH, OK, OR, PA, RI, SC, UT, VA, VT, WI and WV. For most of them, this PR adds taxable_railroad_benefits to a parameter list of subtractions; the KS, MA, ME and UT formulas subtract it directly.

The model builds income for Alabama, Arkansas, Mississippi and New Jersey from each state's own list of sources. None of those lists holds railroad benefits, so they need no change.

Virginia filers subtract the taxable SSEB on Form 760 line 5 and the taxable rest of the annuity on Schedule ADJ. Under Va. Code 58.1-322.03(5), Virginia's age deduction phases out with federal AGI less the benefits that enter federal AGI only under IRC 86, so the SSEB leaves that test and the rest of the annuity stays in it.

Where railroad benefits still move state tax

  • The model charges Idaho's $10 permanent building fund tax when federal gross income exceeds the standard deduction (id_income_tax_liable), and federal gross income includes taxable railroad benefits.
  • Alabama and Missouri let filers deduct federal income tax, and Oregon lets them subtract it (ORS 316.680(1)(b)), so railroad benefits lower these states' bases.
  • New Mexico's low- and middle-income exemption (NMSA 7-2-5.8) and, from 2026, South Carolina's income adjusted deduction (SCIAD, H.4216) phase out with federal AGI. Through 2023, Kansas limited its Social Security subtraction to filers with federal AGI of $75,000 or less. The model applies each of these limits as the state writes it. This PR doesn't take up whether 231m(a) bars a state from counting railroad benefits in such a limit.
  • Colorado and South Carolina (before the SCIAD) start from federal taxable income, which floors at zero. When the standard deduction absorbs some of the benefits, the full subtraction exceeds what federal taxable income gained, so the state base can only fall. The model's Social Security subtractions work the same way.
  • Minnesota reduces its alternative Social Security subtraction by 20 percent of provisional income over a threshold. Under Minn. Stat. 290.0132, subd. 26(i), provisional income starts from section 86(b)(2)'s modified AGI, which leaves out the taxable amount of every section 86 benefit. Its benefits term counts Social Security benefits as section 86(d)(1) defines them, the SSEB included. The model still builds provisional income from title II amounts in mn_social_security_subtraction, so for a filer with both kinds of benefits it counts the taxable SSEB and leaves the SSEB out of the benefits term. This PR leaves that worksheet, and the other state Social Security worksheets that read title II amounts, to a follow-up.

Reforms

tax_unit_taxable_social_security and taxable_social_security now hold only the title II share of taxable benefits. Parameter reforms to section 86 reach both benefits through tax_unit_taxable_section_86_benefits. A reform that replaces tax_unit_taxable_social_security changes title II benefits only and leaves the SSEB on baseline section 86. These reforms and tools read the title II variables, so they leave the SSEB out:

  • the CRFB non-refundable Social Security credit (reforms/crfb/non_refundable_ss_credit.py);
  • the Minnesota HF 1938 and Rhode Island Social Security exemption reforms, though the model already subtracts railroad benefits in both states;
  • PolicyEngine/crfb-tob-impacts, which materializes tax_unit_taxable_social_security.

Invariants

These hold for every input, and test_railroad_retirement_taxation.py checks them with Hypothesis.

  1. Moving benefits between title II and the SSEB leaves AGI, federal income tax, the taxable section 86 amount and Medicaid MAGI unchanged.
  2. Moving an amount between a private pension and the taxable rest of the annuity leaves AGI and federal income tax unchanged.
  3. A household with no income but railroad benefits owes no state income tax before refundable credits in the 41 income tax jurisdictions other than Idaho, and has no Idaho taxable income.
  4. For a wage earner under 65, railroad benefits leave state AGI unchanged. In CO, MI, MN, MT, NC, ND and SC, whose state AGI in the model equals federal AGI, and in Utah, whose total income includes the benefits, they leave state taxable income unchanged instead. In Colorado and South Carolina, when the wage earner has no federal taxable income before the benefits, the base can only fall. The test leaves out Oregon, which subtracts federal income tax, and New Mexico, whose low- and middle-income exemption phases out with federal AGI.
  5. railroad_benefits equals the sum of its three parts, and the title II and SSEB shares sum to the taxable section 86 amount. For a head or spouse, taxable_railroad_benefits equals their taxable SSEB plus taxable_railroad_pension_benefits; dependents get zero.
  6. Section 86 gives the same taxable amount on a dependent's own return as on a filer's return with the same income.

Tests

  • YAML cases, whose comments derive each expected value from the law:
    • irs_gross_income/social_security/railroad_social_security_equivalent_benefits.yaml (7 cases)
    • irs_gross_income/taxable_railroad_benefits.yaml (4)
    • elderly_and_disabled/section_22_railroad_retirement.yaml (3)
    • medicaid/income/medicaid_magi_railroad_retirement.yaml (2)
    • va/tax/income/subtractions/va_railroad_retirement.yaml (2)
    • states/railroad_retirement_benefits.yaml (42), one filer with only railroad benefits in each income tax jurisdiction
  • The new cases and the suites around them pass locally: 2,022 cases across irs_gross_income, elderly_and_disabled, hhs/medicaid/income, the cross-state file, and the Colorado, Montana, North Carolina, Oregon and Virginia tax/income folders.
  • test_railroad_retirement_taxation.py quantifies over amounts, filing status and every state, which YAML cannot. Locally, its six tests take 148 s (184 s with imports) at 1.9 GB peak memory, and I4, which loops over 40 states, takes 85 s of that.
  • test_household_spm_resource_parity.py fails when a federal gross income source has neither an SPM resource that counts its cash nor a documented reason to leave it out. This PR maps both new sources, taxable_railroad_pension_benefits and taxable_railroad_social_security_equivalent_benefits, to railroad_benefits. That file and test_railroad_retirement_taxation.py pass locally, 69 tests in all.

Impact

I'll add the 2026 results on hf://datasets/policyengine/populace-us/populace_us_2024.h5@populace-us-2024-spm-20260909 when the run finishes.

axiom: us:statutes/26/86#tier_1_railroad_retirement_benefit encoded-correct (companion test married_separate_not_apart_with_repayments_substituted_benefits_and_lump_sum_election in us/statutes/26/86.test.yaml); TheAxiomFoundation/rulespec-us#2071 queued (26 U.S.C. 72(r), 45 U.S.C. 231m(a), and companion tests for section 22's railroad reduction and section 86's tier 1 benefit).

🤖 Generated with Claude Code

MaxGhenis and others added 4 commits November 7, 2026 13:29
… benefits

veterans_benefits and railroad_benefits reached neither household_benefits
nor spm_unit_benefits, so neither net income nor SPM resources counted them.
Census P60-200 Appendix A lists veterans' payments as a source of money income
and counts railroad retirement among government transfers.

Both now sit in household_benefits and spm_unit_benefits. Veterans' benefits
stay out of federal gross income under 38 U.S.C. 5301(a)(1). Railroad benefits'
federal tax treatment follows in a separate change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…them from state income

IRC 86(d)(1)(B) treats tier 1 railroad retirement benefits as social
security benefits, and 72(r)(1) treats the rest of the annuity as a
benefit from a section 401(a) plan. 45 U.S.C. 231m(a) bars states from
taxing either, so every state that starts from federal AGI or taxable
income subtracts the amount federal gross income includes.

Section 22's reduction now counts the Railroad Retirement Act amounts the
head and spouse exclude from gross income, as 22(c)(3)(A)(i)(II) says.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e floors, and log the section 22 return-of-cost conflict

Colorado and, before the SCIAD, South Carolina start from federal taxable
income, which floors at zero. When the standard deduction absorbs some of a
filer's railroad benefits, the full 231m subtraction exceeds what federal
taxable income gained, so I4 lets those two bases fall there. I4 always runs
the wage-free case that exposed it.

Section 22(c)(3)(A)(i)(II) reduces the section 22 amount by railroad
annuity amounts excluded from gross income, including the tax-free recovery
of tier 2 contributions; Schedule R line 13b leaves returns of cost out.
candidates.yaml records the conflict and the statute reading the model takes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis and others added 4 commits November 7, 2026 16:23
Section 72(r)(1) treats Railroad Retirement Act benefits other than tier 1
as benefits from a qualified plan, and 72(d)(1)(A) turns off 72(b) for
annuities under a qualified employer retirement plan. The Simplified
Method in 72(d) therefore recovers tier 2 contributions for annuities
that started after November 18, 1996, and 72(b) covers only some older
ones (IRS Pub. 575 (2024), pages 7 and 8). The section 22 comment, the
YAML test header and the conflict entry now cite both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… parity test

#10663 made the parity test require every source in gov.irs.gross_income.sources
to name the SPM resource that counts its cash. railroad_benefits, which #10693
adds to spm_unit_benefits, holds the whole annuity; taxable_railroad_pension_benefits
and taxable_railroad_social_security_equivalent_benefits tax its parts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis changed the base branch from vet-rrb-income-totals to main November 7, 2026 23:28
@MaxGhenis
MaxGhenis marked this pull request as ready for review November 7, 2026 23:28
MaxGhenis and others added 5 commits November 8, 2026 13:15
- Add veterans_benefits and railroad_benefits to the six reform copies of
  the benefit lists (BOOST, End Child Poverty Act, EDAA End Child Poverty
  Act, Texas rebate), which otherwise dropped both benefits and showed a
  false loss under each reform, and to SHARED_CASH_PROGRAMS so the guard
  catches a copy that drops them.
- Narrow the veterans' benefits property test to gross income and AGI,
  checking income tax only when neither household itemizes: the IRS counts
  veterans' benefits as income for the optional sales tax tables. New
  state_sales_tax.yaml cases show the 2025 Texas row moving.
- Keep Combat-Related Special Compensation in veterans_benefits, as
  military_retirement_pay directs, and point VA education benefits and
  dependency and indemnity compensation, and railroad survivor annuities,
  to their own variables.
- Cite the Census appendix once, with its page range.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 2025 Instructions for Schedule A add the nontaxable part of social
security and railroad retirement benefits, and of pension and annuity
distributions, to Form 1040 line 11b to pick the sales tax table row. This
PR adds the untaxed SSEB and the tax-free part of the annuity to that
income list, and no test covered the change. Two Texas cases cross the
$120,000 line on those amounts alone; both fail on the old list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
At $131,072 of wages, float32 steps are $0.015625 wide. Hypothesis found a
case there in which moving 1 percent of a $1 benefit from title II to the
SSEB moved AGI by one step: the railroad household adds its title II and
SSEB shares to AGI separately, and each sum rounds on its own. The tests'
fixed one-cent tolerance fell below one step.

The comparisons now allow eight float32 steps at the sum of the household's
income inputs, and never less than a cent. I3's zero-tax check keeps the
cent. test_i1 pins the failing case with @example; with a one-cent
tolerance it fails on that example, with AGI of $131,072.84375 against
$131,072.859375.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis and others added 4 commits November 8, 2026 15:14
…lief income

45 U.S.C. 231m(a) bars any state tax on Railroad Retirement Act annuities.

- Minnesota's alternative minimum taxable income now subtracts
  taxable_railroad_benefits, since the 2024 Schedule M1MT instructions carry
  Schedule M1M line 17 into line 18.
- Vermont's minimum tax under 32 V.S.A. 5822(a)(6) applies 3 percent to
  federal AGI less taxable_railroad_benefits; the $150,000 test still reads
  federal AGI.
- The 42 state withholding estimates start from the new state_withholding_agi,
  each person's federal AGI less taxable_railroad_benefits, so neither the
  estimates nor the federal deduction for state and local taxes count the
  benefits.
- Pennsylvania's property tax and rent rebate income replaces the taxable SSEB
  in federal AGI with half of the SSEB (PA-1000 line 5) and adds the tax-free
  recovery of the rest of the annuity (line 6, gross amount).
- Utah's homeowner and renter relief adds only the railroad benefits that
  federal AGI leaves out.

Tests: new YAML cases for each fix, zero withholding in the 42 railroad-only
state cases, and two Hypothesis examples plus a withholding check in the
state invariant. Each new case fails at 033d78e except North Dakota's,
whose zero bracket already left withholding at zero.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- veterans_benefits: is_veteran reads this input, so a survivor or
  dependent whose VA payments go here should set is_veteran to false.
- disability_benefits: VA disability compensation goes in veterans_benefits.
- SSI unearned sources note: household net income now counts railroad
  benefits; SNAP, HUD and the other program lists still don't (#10551).
- Parity test docstring: list the two new invariants, and say the
  veterans' income tax check covers filers under 65 without a disability,
  since the model doesn't yet reduce the section 22 credit by VA pensions
  (26 U.S.C. 22(c)(3)(A)(i)(III)).
- Sales tax test comment: the table gives the amount a filer may deduct.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Answers the federal, states and tests reviews of 033d78e.

States:
- West Virginia: box (c) of Schedule M line 47 leaves out income
  reported on lines 35 to 48, and filers subtract railroad benefits on
  line 40, so taxable_railroad_benefits joins the excluded sources.
- Arizona: the 2025 Form 140PTC instructions (page 4) leave railroad
  retirement benefits out of the property tax credit's income. Subtract
  the head's and spouse's taxable_railroad_benefits from federal AGI and
  leave both railroad sources out of a dependent's income.
- Oregon: ORS 316.157(2)(f) counts tier 1 benefits as Social Security
  benefits and (2)(b) leaves them out of household income. Subtract the
  taxable SSEB from household income and add the SSEB to line 5.
- Minnesota: Minn. Stat. 290.0802 subd. 1(a) and (c). Subtract
  taxable_railroad_benefits from the elderly and disabled subtraction's
  AGI and reduce its base by the head's and spouse's railroad_benefits.

Federal:
- WATCA's alternative tax MAGI adds the nontaxable SSEB (S.4083 section
  1A adds the section 86(d) benefits gross income leaves out).
- taxsim_gssi counts the SSEB, so taxsim_v12 reruns section 86 on both.
- Reject a negative or non-finite SSEB, as the model rejects negative title II benefits;
  the model doesn't net amounts as Publication 915 does.
- The TOB variables document that they leave out HI's 1993-amendment
  share of the tax on the SSEB (section 121(e)(1)(B), (3)(C)).
- Uprate the railroad pension inputs with SOI pension income.
- Document that an entered railroad_benefits total replaces the parts,
  reaches no tax and applies only to its year.

Tests: a YAML case for each fix and a WATCA and TAXSIM case; I1 checks
the section 22 amount with an age-70 example; I3 draws 2025 and 2026;
I5 checks each spouse's share of the taxable SSEB; a negative and NaN
SSEB test; the sales tax test lists both untaxed railroad items. The
added inputs move to an added changelog fragment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis and others added 3 commits November 11, 2026 14:27
…enefits

Section 1303, "Income" (2), counts 50% of railroad retirement benefits from
1999 and names no tier. Rebate income now takes the taxable railroad benefits
out of federal AGI and adds half of all railroad benefits, in place of Form
PA-1000's half of tier 1 and all of tier 2. Restore main's Case 3, add the
same case entered as the tier 1 part, and move cases 3a and 3b to 11,000 and
25,000.

Log the Pennsylvania and Oregon form conflicts in
source_conflicts/candidates.yaml, and leave the Minnesota M1R conflict to the
entry PR 10722 adds. Point the Utah reference at page 4.

Tests: property examples draw deterministically; the SSEB check rejects an
infinite amount as well as a negative one; I6 checks that each railroad
dollar adds 50 cents to Pennsylvania rebate income, entered by part or as a
total, with each entry in its own simulation; West Virginia's 2014 case
enters taxable_railroad_benefits: 0, since it enters AGI directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main's property tax credit invariant keeps number 7 in
test_household_spm_resource_parity.py; this branch's two invariants become 8
and 9. test_aggregate_list_integrity.py lists the benefits beside main's
state_property_tax_refunds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Montana's subtraction list keeps taxable_railroad_benefits in every block
beside main's repeal of the disability income exclusion, and its references
keep both the 231m(a) citation and main's repeal citations. Utah's existing
case takes main's 51,087.05 expectation, and the railroad case follows it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant