From b635c0bb86556c741cfd5c84ca7916b0a25217a3 Mon Sep 17 00:00:00 2001 From: David Trimmer Date: Thu, 19 Nov 2026 17:22:39 -0500 Subject: [PATCH 1/2] Count all of New Mexico's modified gross income sources Add farm, partnership and S corporation income, capital gain distributions, Form 4797 gains, general assistance, workers' compensation, disability benefits, discharged debt, gross gambling winnings, cash gifts, scholarships, miscellaneous income and excluded foreign earned income to New Mexico modified gross income (NMSA 1978 7-2-2(L), 3.3.1.10 NMAC, 2025 PIT-RC lines 4 to 11). Floor each person-level source per person, so one spouse's loss no longer reduces the other's income, and count short- and long-term capital gains separately with the long-term carryover added back, so capital losses no longer reduce gains. Co-Authored-By: Claude Opus 5.5 --- .../nm-modified-gross-income-sources.fixed.md | 1 + .../nm/tax/income/modified_gross_income.yaml | 53 ++- .../tax/income/nm_modified_gross_income.yaml | 305 +++++++++++++++++- .../nm_property_tax_rebate_eligibility.yaml | 28 ++ .../nm/tax/income/nm_modified_gross_income.py | 27 +- ...ed_gross_income_long_term_capital_gains.py | 36 +++ 6 files changed, 437 insertions(+), 13 deletions(-) create mode 100644 changelog.d/nm-modified-gross-income-sources.fixed.md create mode 100644 policyengine_us/variables/gov/states/nm/tax/income/nm_modified_gross_income_long_term_capital_gains.py diff --git a/changelog.d/nm-modified-gross-income-sources.fixed.md b/changelog.d/nm-modified-gross-income-sources.fixed.md new file mode 100644 index 00000000000..915a2fea3f2 --- /dev/null +++ b/changelog.d/nm-modified-gross-income-sources.fixed.md @@ -0,0 +1 @@ +New Mexico modified gross income now counts farm, partnership and S corporation income, capital gain distributions, Form 4797 gains, general assistance, workers' compensation, disability benefits, discharged debt, gross gambling winnings, cash gifts, scholarships, miscellaneous income and excluded foreign earned income. Each source is now floored at zero person by person, and capital losses and loss carryovers no longer reduce capital gains. diff --git a/policyengine_us/parameters/gov/states/nm/tax/income/modified_gross_income.yaml b/policyengine_us/parameters/gov/states/nm/tax/income/modified_gross_income.yaml index 077eb144f5d..05ab62be794 100644 --- a/policyengine_us/parameters/gov/states/nm/tax/income/modified_gross_income.yaml +++ b/policyengine_us/parameters/gov/states/nm/tax/income/modified_gross_income.yaml @@ -2,33 +2,78 @@ description: New Mexico includes these income sources in its modified gross inco values: 2021-01-01: - tax_unit_social_security - - capital_gains + # NMSA 1978 § 7-2-2(L)(3) gains from dealings in property; PIT-RC line 9: + # "Enter your gross capital gains. Do not reduce them by capital losses." + # The short- and long-term parts are listed separately so one never + # reduces the other, and the long-term part is taken before the prior-year + # capital loss carryover. + - short_term_capital_gains + - nm_modified_gross_income_long_term_capital_gains + # Capital gain distributions reported without Schedule D (§ 7-2-2(L)(3); + # PIT-RC line 9). + - non_sch_d_capital_gains + # Form 4797 ordinary gains: PIT-RC line 11, "All ordinary gains from + # dealing in or selling property". + - other_net_gain - tanf - ssi + # § 7-2-2(L)(19) public assistance and welfare benefits; 3.3.1.10(A)(1)(d) + # NMAC names general assistance; PIT-RC line 7. + - general_assistance - interest_income - dividend_income - alimony_income - child_support_received - rental_income + # § 7-2-2(L)(2) net profit from business, (5) net rents; PIT-RC line 8: + # net profit from business, farm, or rentals. + - farm_operations_income + - farm_rent_income + # § 7-2-2(L)(13) distributive share of partnership income; PIT-RC line 11: + # "Distributions from partnerships, S corporations, or similar + # pass-through entities". + - partnership_s_corp_income - pension_income # NMSA 1978 § 7-2-2(L)(9), (11): annuities and pensions, including military # retired pay and survivor annuities, which pension_income leaves out. - military_retirement_income - retirement_distributions - total_unemployment_compensation + # § 7-2-2(L)(18) workers' compensation benefits; PIT-RC line 6. + - workers_compensation + # 3.3.1.10(C) NMAC: "disability payments from whatever source", both the + # taxable and the tax-exempt part. + - disability_benefits - irs_employment_income - self_employment_income - sstb_self_employment_income - veterans_benefits # NMSA 1978 § 7-2-2(L)(15): income from an interest in an estate or a trust - estate_income - # income such as gambling winnings, insurance settlements, scholarships, - # grants and inheritance, + # § 7-2-2(L)(12) discharge of indebtedness; PIT-RC line 11. The input does + # not separate the bankruptcy discharges the line leaves out. + - debt_relief + # PIT-RC line 11: "Gross gambling, gaming, and lottery winnings from any + # source without reducing winnings by any losses". + - gambling_winnings + # § 7-2-2(L)(21) gifts; PIT-RC line 10: all gifts of cash. + - financial_assistance + # 3.3.1.10(A)(2) NMAC: scholarships, grants, fellowships or similar + # payments which do not have to be repaid; PIT-RC line 11. + - educational_assistance + # § 7-2-2(L): all income "from whatever source"; PIT-RC line 11: all income + # not included on lines 4 to 10, such as other cash prizes and awards. + - miscellaneous_income + # PIT-RC: all income "regardless of whether that income is taxable by the + # U.S. Government", so foreign earned income excluded under IRC 911 counts. + - section_911_excluded_income metadata: unit: list label: New Mexico modified gross income elements reference: - title: New Mexico Income Tax Act, Chapter 7 - Taxation, 7-2-2. Definitions, L href: https://nmonesource.com/nmos/nmsa/en/item/4340/index.do#!fragment/zoupio-_Toc140503656/BQCwhgziBcwMYgK4DsDWszIQewE4BUBTADwBdoAvbRABwEtsBaAfX2zgEYAWABgFYeAZgBsfYQEoANMmylCEAIqJCuAJ7QA5BskRCYXAiUr1WnXoMgAynlIAhdQCUAogBknANQCCAOQDCTyVIwACNoUnZxcSA - - title: "2025 PIT-RC instructions, modified gross income (an annuity, pension, retirement pay; line 5 pensions and annuities; line 11 estate or trust) #page 2,4" + - title: "2025 PIT-RC instructions, modified gross income (records table: an annuity, pension, retirement pay or sick pay; general definition and lines 4 to 11) #page 2,4" href: https://taxsim.nber.org/historical_state_tax_forms/NM/2025/NM_PIT_RC_INST.PDF#page=2 + - title: 3.3.1.10 NMAC, Modified gross income (A)(1)(d), (A)(2), (B), (C) + href: https://www.law.cornell.edu/regulations/new-mexico/N-M-Admin-Code-SS-3.3.1.10 diff --git a/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/nm_modified_gross_income.yaml b/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/nm_modified_gross_income.yaml index a7defcd52e8..8f7a8ceeeaf 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/nm_modified_gross_income.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/nm_modified_gross_income.yaml @@ -1,5 +1,11 @@ # NM Admin Code 3.3.1.10: "zero is the lowest amount which may be reported # for any item in computing modified gross income" +# NMSA 1978 7-2-2(L): "modified gross income" means all income of the +# taxpayer and, if any, the taxpayer's spouse and dependents, undiminished by +# losses and from whatever source, including the 21 listed items. +# 3.3.1.10(B) NMAC: the loss from one business or activity shall not reduce +# the income from another business or activity. +# PIT-RC lines are those of the 2025 PIT-RC instructions, PDF page 4. - name: NM modified gross income with positive income only period: 2024 @@ -36,7 +42,8 @@ short_term_capital_gains: -20_000 long_term_capital_gains: -10_000 output: - # Capital gains undiminished by losses: floor to zero + # Each capital gain part is floored at zero: + # 50,000 + max(-20,000, 0) + max(-10,000, 0) = 50,000. nm_modified_gross_income: 50_000 - name: NM rental loss should not reduce modified gross income @@ -59,12 +66,16 @@ long_term_capital_gains: -15_000 dividend_income: 5_000 output: - # interest: max(100000, 0) = 100000 - # self_employment: max(-50000, 0) = 0 - # rental: max(-20000, 0) = 0 - # capital_gains: max(10000 + -15000, 0) = max(-5000, 0) = 0 - # dividends: max(5000, 0) = 5000 - nm_modified_gross_income: 105_000 + # interest: max(100,000, 0) = 100,000 + # self_employment: max(-50,000, 0) = 0 + # rental: max(-20,000, 0) = 0 + # short-term capital gains: max(10,000, 0) = 10,000 + # long-term capital gains: max(-15,000 + 0 carryover, 0) = 0 + # dividends: max(5,000, 0) = 5,000 + # PIT-RC line 9: gross capital gains, not reduced by capital losses, so + # the long-term loss does not offset the short-term gain. + # 100,000 + 10,000 + 5,000 = 115,000 + nm_modified_gross_income: 115_000 - name: NM modified gross income includes retirement distributions for rebate eligibility period: 2026 @@ -123,3 +134,283 @@ # a survivor annuity count: # 20,000 + 30,000 + 6,000. nm_modified_gross_income: 56_000 + +- name: NM modified gross income includes farm income + period: 2025 + input: + state_code: NM + irs_employment_income: 20_000 + farm_operations_income: 15_000 + farm_rent_income: 1_000 + output: + # 7-2-2(L)(2) net profit from business and (L)(5) net rents; PIT-RC line + # 8, net profit from business, farm, or rentals. + # 20,000 + 15,000 + 1,000 = 36,000. + nm_modified_gross_income: 36_000 + +- name: NM farm loss does not reduce other income + period: 2025 + input: + state_code: NM + irs_employment_income: 20_000 + farm_operations_income: -8_000 + output: + # PIT-RC line 8: a farm loss enters as zero and may not offset any other + # source of income. 20,000 + max(-8,000, 0) = 20,000. + nm_modified_gross_income: 20_000 + +- name: NM modified gross income includes partnership income + period: 2025 + input: + state_code: NM + irs_employment_income: 20_000 + partnership_income: 12_000 + output: + # 7-2-2(L)(13) distributive share of partnership income; PIT-RC line 11, + # distributions from partnerships, S corporations, or similar entities. + # 20,000 + 12,000 = 32,000. + nm_modified_gross_income: 32_000 + +- name: NM one spouse's business loss does not reduce the other spouse's business income + period: 2025 + input: + people: + head: + is_tax_unit_head: true + self_employment_income: 30_000 + spouse: + is_tax_unit_spouse: true + self_employment_income: -10_000 + tax_units: + tax_unit: + members: [head, spouse] + filing_status: JOINT + households: + household: + members: [head, spouse] + state_code: NM + output: + # 3.3.1.10(B) NMAC and PIT-RC line 8: the spouse's business counts as zero + # and its loss does not reduce the head's business income. + # max(30,000, 0) + max(-10,000, 0) = 30,000. + nm_modified_gross_income: 30_000 + +- name: NM one spouse's capital loss does not reduce the other spouse's capital gain + period: 2025 + input: + people: + head: + is_tax_unit_head: true + long_term_capital_gains: 10_000 + spouse: + is_tax_unit_spouse: true + long_term_capital_gains: -3_000 + tax_units: + tax_unit: + members: [head, spouse] + filing_status: JOINT + households: + household: + members: [head, spouse] + state_code: NM + output: + # 3.3.1.10(B) NMAC; PIT-RC line 9: gross capital gains, not reduced by + # capital losses. Each spouse's gain is floored on its own: + # max(10,000, 0) + max(-3,000, 0) = 10,000. + nm_modified_gross_income: 10_000 + +- name: NM capital gains are not reduced by capital losses + period: 2025 + input: + state_code: NM + long_term_capital_gains: 10_000 + short_term_capital_gains: -4_000 + output: + # PIT-RC line 9: gross capital gains, not reduced by capital losses. + # max(10,000, 0) + max(-4,000, 0) = 10,000. + nm_modified_gross_income: 10_000 + +- name: NM capital gains are not reduced by a prior-year capital loss carryover + period: 2025 + input: + state_code: NM + # The year's own long-term gain is 7,000; long_term_capital_gains nets + # the 5,000 carryover against it, as Schedule D line 15 does. + long_term_capital_gains: 2_000 + long_term_capital_loss_carryover: 5_000 + output: + # PIT-RC line 9: gross capital gains, not reduced by capital losses. + # 2,000 + 5,000 = 7,000. + nm_modified_gross_income_long_term_capital_gains: 7_000 + nm_modified_gross_income: 7_000 + +- name: NM carryover larger than the year's gain restores only the gain + period: 2025 + input: + state_code: NM + irs_employment_income: 20_000 + # The year's own long-term gain is 3,000; netting the 5,000 carryover + # leaves -2,000. + long_term_capital_gains: -2_000 + long_term_capital_loss_carryover: 5_000 + output: + # -2,000 + 5,000 = 3,000; the unused 2,000 of the carryover never counts + # as income. 20,000 + 3,000 = 23,000. + nm_modified_gross_income_long_term_capital_gains: 3_000 + nm_modified_gross_income: 23_000 + +- name: NM long-term loss for the year with a carryover counts as zero + period: 2025 + input: + state_code: NM + irs_employment_income: 20_000 + # The year's own long-term loss is 1,000, plus the 5,000 carryover. + long_term_capital_gains: -6_000 + long_term_capital_loss_carryover: 5_000 + output: + # -6,000 + 5,000 = -1,000, floored at zero. 20,000 + 0 = 20,000. + nm_modified_gross_income_long_term_capital_gains: -1_000 + nm_modified_gross_income: 20_000 + +- name: NM modified gross income includes capital gain distributions + period: 2025 + input: + state_code: NM + irs_employment_income: 20_000 + non_sch_d_capital_gains: 500 + output: + # 7-2-2(L)(3) gains from dealings in property; PIT-RC line 9. + # 20,000 + 500 = 20,500. + nm_modified_gross_income: 20_500 + +- name: NM modified gross income includes Form 4797 ordinary gains + period: 2025 + input: + state_code: NM + irs_employment_income: 20_000 + other_net_gain: 3_000 + output: + # 7-2-2(L)(3); PIT-RC line 11, all ordinary gains from dealing in or + # selling property. 20,000 + 3,000 = 23,000. + nm_modified_gross_income: 23_000 + +- name: NM Form 4797 loss does not reduce other income + period: 2025 + input: + state_code: NM + irs_employment_income: 20_000 + other_net_gain: -5_000 + output: + # other_net_gain is a tax-unit amount, floored for the tax unit: + # 20,000 + max(-5,000, 0) = 20,000. + nm_modified_gross_income: 20_000 + +- name: NM modified gross income includes general assistance + period: 2025 + input: + state_code: NM + irs_employment_income: 5_000 + general_assistance: 3_000 + output: + # 7-2-2(L)(19) public assistance and welfare benefits; 3.3.1.10(A)(1)(d) + # NMAC names general assistance; PIT-RC line 7. + # 5,000 + 3,000 = 8,000. + nm_modified_gross_income: 8_000 + +- name: NM modified gross income includes workers' compensation + period: 2025 + input: + state_code: NM + irs_employment_income: 20_000 + workers_compensation: 8_000 + output: + # 7-2-2(L)(18) workers' compensation benefits; PIT-RC line 6. + # 20,000 + 8,000 = 28,000. + nm_modified_gross_income: 28_000 + +- name: NM modified gross income includes disability benefits + period: 2025 + input: + state_code: NM + irs_employment_income: 20_000 + disability_benefits: 6_000 + output: + # 3.3.1.10(C) NMAC: sick pay and disability payments from whatever + # source are modified gross income. + # 20,000 + 6,000 = 26,000. + nm_modified_gross_income: 26_000 + +- name: NM modified gross income includes discharge of indebtedness + period: 2025 + input: + state_code: NM + irs_employment_income: 20_000 + debt_relief: 5_000 + output: + # 7-2-2(L)(12) discharge of indebtedness; PIT-RC line 11. + # 20,000 + 5,000 = 25,000. + nm_modified_gross_income: 25_000 + +- name: NM modified gross income includes gross gambling winnings + period: 2025 + input: + state_code: NM + irs_employment_income: 20_000 + gambling_winnings: 4_000 + gambling_losses: 4_000 + output: + # PIT-RC line 11: gross gambling, gaming and lottery winnings from any + # source, without reducing winnings by any losses. + # 20,000 + 4,000 = 24,000. + nm_modified_gross_income: 24_000 + +- name: NM modified gross income includes gifts of cash + period: 2025 + input: + state_code: NM + irs_employment_income: 20_000 + financial_assistance: 2_000 + output: + # 7-2-2(L)(21) gifts; PIT-RC line 10, all gifts of cash. + # 20,000 + 2,000 = 22,000. + nm_modified_gross_income: 22_000 + +- name: NM modified gross income includes scholarships and grants + period: 2025 + input: + state_code: NM + irs_employment_income: 20_000 + educational_assistance: 4_000 + output: + # 3.3.1.10(A)(2) NMAC: scholarships, grants, fellowships or similar + # payments which do not have to be repaid are modified gross income; + # PIT-RC line 11. + # 20,000 + 4,000 = 24,000. + nm_modified_gross_income: 24_000 + +- name: NM modified gross income includes miscellaneous income + period: 2025 + input: + state_code: NM + irs_employment_income: 20_000 + miscellaneous_income: 1_500 + output: + # 7-2-2(L): all income from whatever source; PIT-RC line 11, all income + # not included on lines 4 to 10 (other cash prizes and awards and the + # like). + # 20,000 + 1,500 = 21,500. + nm_modified_gross_income: 21_500 + +- name: NM modified gross income includes foreign earned income excluded from federal income + period: 2025 + input: + state_code: NM + irs_employment_income: 20_000 + # Wage inputs are the amounts left after the IRC 911 exclusion. + foreign_earned_income_exclusion: 10_000 + output: + # 7-2-2(L): all income from whatever source. PIT-RC: all income and + # other compensation from all sources, regardless of whether that income + # is taxable by the U.S. Government. + # 20,000 + 10,000 = 30,000. + nm_modified_gross_income: 30_000 diff --git a/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/rebates/nm_property_tax_rebate_eligibility.yaml b/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/rebates/nm_property_tax_rebate_eligibility.yaml index f886a19850b..7f0faec9a6d 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/rebates/nm_property_tax_rebate_eligibility.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/rebates/nm_property_tax_rebate_eligibility.yaml @@ -168,3 +168,31 @@ state_code: NM output: nm_property_tax_rebate_eligible: true + +- name: 2025 workers' compensation counts toward the income limit, at the limit + period: 2025 + input: + state_code: NM + age: 70 + social_security_retirement: 12_000 + workers_compensation: 4_000 + output: + # NMSA 7-2-2(L)(16), (18); PIT-RC lines 5 and 6: Social Security and + # workers' compensation are modified gross income. + # 12,000 + 4,000 = 16,000 <= 16,000, so eligible. (SSI is zero: 12,000 / + # 12 - 20 = 980 a month of countable income, above the 967 federal + # benefit rate.) + nm_modified_gross_income: 16_000 + nm_property_tax_rebate_eligible: true + +- name: 2025 workers' compensation counts toward the income limit, just above it + period: 2025 + input: + state_code: NM + age: 70 + social_security_retirement: 12_000 + workers_compensation: 4_001 + output: + # 12,000 + 4,001 = 16,001 > 16,000, so ineligible. + nm_modified_gross_income: 16_001 + nm_property_tax_rebate_eligible: false diff --git a/policyengine_us/variables/gov/states/nm/tax/income/nm_modified_gross_income.py b/policyengine_us/variables/gov/states/nm/tax/income/nm_modified_gross_income.py index 6f40f8e9a5b..195a609a83b 100644 --- a/policyengine_us/variables/gov/states/nm/tax/income/nm_modified_gross_income.py +++ b/policyengine_us/variables/gov/states/nm/tax/income/nm_modified_gross_income.py @@ -6,21 +6,44 @@ class nm_modified_gross_income(Variable): entity = TaxUnit label = "New Mexico modified gross income" unit = USD + documentation = ( + "All income of the taxpayer, spouse and dependents, undiminished by " + "losses and from whatever source, for the New Mexico rebates and " + "credits on Schedule PIT-RC. Each listed source counts at zero or " + "more: a person-level source is floored for each person before the " + "tax unit sums it, so one person's loss does not reduce another " + "person's income, and a source defined for the tax unit or a larger " + "group is floored for the tax unit." + ) definition_period = YEAR reference = ( "https://nmonesource.com/nmos/nmsa/en/item/4340/index.do#!fragment/zoupio-_Toc140503656", "https://www.law.cornell.edu/regulations/new-mexico/N-M-Admin-Code-SS-3.3.1.10", + "https://taxsim.nber.org/historical_state_tax_forms/NM/2025/NM_PIT_RC_INST.PDF#page=4", ) defined_for = StateCode.NM def formula(tax_unit, period, parameters): - # Per NM Admin Code 3.3.1.10: + # Per NM Admin Code 3.3.1.10(B): # "zero is the lowest amount which may be reported for any item # in computing 'modified gross income'" # "The loss from one business or activity shall not reduce # the income from another business or activity." + # PIT-RC line 8: you "may not offset the loss of one business, farm, + # or rental against the profit of another business, farm, or rental + # or against any other source of income." sources = parameters(period).gov.states.nm.tax.income.modified_gross_income + person = tax_unit.members total = 0 for source in sources: - total += max_(add(tax_unit, period, [source]), 0) + if tax_unit.entity.get_variable(source).entity.is_person: + # Each person's amount is floored, so a spouse's or + # dependent's loss does not reduce another member's income. + total += tax_unit.sum(max_(person(source, period), 0)) + else: + # Sources defined for the tax unit (tax_unit_social_security, + # other_net_gain, section_911_excluded_income) or for a larger + # group (tanf, whose SPM unit amount add apportions to the + # tax unit by its members) are floored for the tax unit. + total += max_(add(tax_unit, period, [source]), 0) return total diff --git a/policyengine_us/variables/gov/states/nm/tax/income/nm_modified_gross_income_long_term_capital_gains.py b/policyengine_us/variables/gov/states/nm/tax/income/nm_modified_gross_income_long_term_capital_gains.py new file mode 100644 index 00000000000..f3e2710b00f --- /dev/null +++ b/policyengine_us/variables/gov/states/nm/tax/income/nm_modified_gross_income_long_term_capital_gains.py @@ -0,0 +1,36 @@ +from policyengine_us.model_api import * + + +class nm_modified_gross_income_long_term_capital_gains(Variable): + value_type = float + entity = Person + label = "New Mexico modified gross income long-term capital gains" + unit = USD + documentation = ( + "A person's long-term capital gain or loss for the year, before the " + "prior-year long-term capital loss carryover, for New Mexico modified " + "gross income. Modified gross income counts gross capital gains, not " + "reduced by capital losses, so the carryover that " + "long_term_capital_gains nets (as Schedule D line 15 does) is added " + "back. nm_modified_gross_income floors this amount at zero for each " + "person, apart from short-term gains, so only the gain the carryover " + "hid is restored, never the unused loss. Short-term inputs must hold " + "only the year's own gains and losses; no short-term carryover memo " + "is modeled. Losses netted inside one input cannot be separated." + ) + definition_period = YEAR + reference = ( + "https://nmonesource.com/nmos/nmsa/en/item/4340/index.do#!fragment/zoupio-_Toc140503656", + "https://taxsim.nber.org/historical_state_tax_forms/NM/2025/NM_PIT_RC_INST.PDF#page=4", + "https://www.law.cornell.edu/regulations/new-mexico/N-M-Admin-Code-SS-3.3.1.10", + "https://www.law.cornell.edu/uscode/text/26/1212#b_1_B", + ) + defined_for = StateCode.NM + + def formula(person, period, parameters): + # NMSA 1978 § 7-2-2(L): income "undiminished by losses"; PIT-RC line + # 9: "Do not reduce them by capital losses." long_term_capital_gains + # includes the carryover (26 U.S.C. 1212(b)(1)(B)) as a loss, so + # adding it back gives the year's own long-term gain or loss. + carryover = max_(0, person("long_term_capital_loss_carryover", period)) + return person("long_term_capital_gains", period) + carryover From 6524da413e3227221f85084ab3a6f63de853b60d Mon Sep 17 00:00:00 2001 From: David Trimmer <178813244+DTrim99@users.noreply.github.com> Date: Fri, 20 Nov 2026 11:13:05 -0500 Subject: [PATCH 2/2] Fix issues from review: floor partnership and S-corp income separately in NM modified gross income Add nm_modified_gross_income_partnership_s_corp_income, which floors partnership and S-corp income at zero separately and falls back to the combined partnership_s_corp_income input when neither part is set. List it in the NM modified gross income sources in place of partnership_s_corp_income, avoid in-place += on the formula's array, and add test cases for an S-corp loss and a combined-only input. Co-Authored-By: Claude Opus 5.5 --- .../nm/tax/income/modified_gross_income.yaml | 7 +++- .../tax/income/nm_modified_gross_income.yaml | 23 +++++++++++ .../nm/tax/income/nm_modified_gross_income.py | 4 +- ..._gross_income_partnership_s_corp_income.py | 39 +++++++++++++++++++ 4 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 policyengine_us/variables/gov/states/nm/tax/income/nm_modified_gross_income_partnership_s_corp_income.py diff --git a/policyengine_us/parameters/gov/states/nm/tax/income/modified_gross_income.yaml b/policyengine_us/parameters/gov/states/nm/tax/income/modified_gross_income.yaml index 05ab62be794..321a37fde8e 100644 --- a/policyengine_us/parameters/gov/states/nm/tax/income/modified_gross_income.yaml +++ b/policyengine_us/parameters/gov/states/nm/tax/income/modified_gross_income.yaml @@ -31,8 +31,11 @@ values: - farm_rent_income # § 7-2-2(L)(13) distributive share of partnership income; PIT-RC line 11: # "Distributions from partnerships, S corporations, or similar - # pass-through entities". - - partnership_s_corp_income + # pass-through entities". 3.3.1.10(B) NMAC: "The loss from one business + # or activity shall not reduce the income from another business or + # activity", so the helper floors partnership and S corporation income + # each on its own, falling back to a combined amount entered directly. + - nm_modified_gross_income_partnership_s_corp_income - pension_income # NMSA 1978 § 7-2-2(L)(9), (11): annuities and pensions, including military # retired pay and survivor annuities, which pension_income leaves out. diff --git a/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/nm_modified_gross_income.yaml b/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/nm_modified_gross_income.yaml index 8f7a8ceeeaf..ae3bef032ba 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/nm_modified_gross_income.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/nm_modified_gross_income.yaml @@ -414,3 +414,26 @@ # is taxable by the U.S. Government. # 20,000 + 10,000 = 30,000. nm_modified_gross_income: 30_000 + +- name: NM S corporation loss does not reduce partnership income + period: 2025 + input: + state_code: NM + partnership_income: 30_000 + s_corp_income: -20_000 + output: + # 3.3.1.10(B) NMAC: the loss from one business or activity shall not + # reduce the income from another business or activity, and zero is the + # lowest amount reported for any item. Each source is floored on its own: + # max(30,000, 0) + max(-20,000, 0) = 30,000 + 0 = 30,000. + nm_modified_gross_income: 30_000 + +- name: NM modified gross income counts partnership and S corporation income entered as one amount + period: 2025 + input: + state_code: NM + partnership_s_corp_income: 50_000 + output: + # partnership_income and s_corp_income are both zero, so the combined + # amount entered directly is used: max(50,000, 0) = 50,000. + nm_modified_gross_income: 50_000 diff --git a/policyengine_us/variables/gov/states/nm/tax/income/nm_modified_gross_income.py b/policyengine_us/variables/gov/states/nm/tax/income/nm_modified_gross_income.py index 195a609a83b..d91d8ab3f1a 100644 --- a/policyengine_us/variables/gov/states/nm/tax/income/nm_modified_gross_income.py +++ b/policyengine_us/variables/gov/states/nm/tax/income/nm_modified_gross_income.py @@ -39,11 +39,11 @@ def formula(tax_unit, period, parameters): if tax_unit.entity.get_variable(source).entity.is_person: # Each person's amount is floored, so a spouse's or # dependent's loss does not reduce another member's income. - total += tax_unit.sum(max_(person(source, period), 0)) + total = total + tax_unit.sum(max_(person(source, period), 0)) else: # Sources defined for the tax unit (tax_unit_social_security, # other_net_gain, section_911_excluded_income) or for a larger # group (tanf, whose SPM unit amount add apportions to the # tax unit by its members) are floored for the tax unit. - total += max_(add(tax_unit, period, [source]), 0) + total = total + max_(add(tax_unit, period, [source]), 0) return total diff --git a/policyengine_us/variables/gov/states/nm/tax/income/nm_modified_gross_income_partnership_s_corp_income.py b/policyengine_us/variables/gov/states/nm/tax/income/nm_modified_gross_income_partnership_s_corp_income.py new file mode 100644 index 00000000000..b67a1ffc5ad --- /dev/null +++ b/policyengine_us/variables/gov/states/nm/tax/income/nm_modified_gross_income_partnership_s_corp_income.py @@ -0,0 +1,39 @@ +from policyengine_us.model_api import * + + +class nm_modified_gross_income_partnership_s_corp_income(Variable): + value_type = float + entity = Person + label = "New Mexico modified gross income partnership and S corporation income" + unit = USD + documentation = ( + "A person's partnership and S corporation income for New Mexico " + "modified gross income. The loss from one business or activity shall " + "not reduce the income from another, so partnership_income and " + "s_corp_income are each floored at zero on their own. When neither is " + "supplied, partnership_s_corp_income may be a combined amount entered " + "directly (as the TAXSIM emulator and older datasets do), and that " + "amount, floored at zero, is used instead; losses netted inside it " + "cannot be separated." + ) + definition_period = YEAR + reference = ( + "https://www.law.cornell.edu/regulations/new-mexico/N-M-Admin-Code-SS-3.3.1.10", + "https://nmonesource.com/nmos/nmsa/en/item/4340/index.do#!fragment/zoupio-_Toc140503656", + "https://taxsim.nber.org/historical_state_tax_forms/NM/2025/NM_PIT_RC_INST.PDF#page=4", + ) + defined_for = StateCode.NM + + def formula(person, period, parameters): + # 3.3.1.10(B) NMAC: "The loss from one business or activity shall not + # reduce the income from another business or activity." + # NOTE: partnership_s_corp_income adds the two parts, but it can be + # set directly with both parts left at zero; once it is an input for + # anyone in a simulation, everyone else holds its default of zero, so + # the parts decide whenever either is nonzero. + partnership_income = person("partnership_income", period) + s_corp_income = person("s_corp_income", period) + parts_supplied = (partnership_income != 0) | (s_corp_income != 0) + floored_parts = max_(partnership_income, 0) + max_(s_corp_income, 0) + combined = max_(person("partnership_s_corp_income", period), 0) + return where(parts_supplied, floored_parts, combined)