Repository navigation
Keep capital gains and losses out of Massachusetts Part B income - #9954
Conversation
ma_part_b_gross_income subtracted Part A and Part C gross income from ma_gross_income. Those net capital losses the Schedule B and D way, but irs_gross_income adds each filer's net capital gain floored at zero, so the difference stayed in Part B: a long-term loss against a short-term gain reduced Part B, and one spouse's short-term loss against the other spouse's long-term gain added phantom Part B income. Subtract the same dividend and capital gain amounts irs_gross_income adds instead (M.G.L. c. 62 s. 2(b), s. 2(d)(1)(M)). Fixes #9953. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
non_sch_d_capital_gains (Form 1040 line 7 distributions without a federal Schedule D) entered ma_gross_income through irs_gross_income but neither Part A nor Part C, so it stayed in Part B. Massachusetts reports them on Schedule D, line 6: add them to the long-term amount in ma_part_c_gross_income and ma_part_a_agi, and take them out of ma_part_b_gross_income. Fixes #9957. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hua7450
left a comment
There was a problem hiding this comment.
Approving. Read the three formulas at 01b1873 and on main, plus ma_gross_income, ma_part_a_gross_income, irs_gross_income with gov/irs/gross_income/sources.yaml, and the capital_gains aggregate, against M.G.L. c. 62 s. 2(b) and the 2023 Form 1 instructions (Schedule D line 6 for capital gain distributions, page 27).
The new Part B formula subtracts exactly what irs_gross_income adds for the filers (each person's dividends, max_(0, capital_gains) and max_(0, non_sch_d_capital_gains), dependents excluded), so Part B is Form 1 line 10 with no capital component in any sign case and a net loss can never reduce it. The main formula subtracted ma_part_a_gross_income + ma_part_c_gross_income, whose unit-level netting differs from the per-person floor: with short-term 3,000 and long-term -1,000, gross income carries 2,000 but main removed 3,000 and understated Part B by 1,000; head gives 60,000 on 60,000 of wages, as the new case expects. Interest is unaffected because ma_part_a_gross_income never held it. Counting capital gain distributions in ma_part_c_gross_income and in the Schedule D line 13 amount inside ma_part_a_agi matches Schedule D line 6, and the three edits are consistent with each other, so the Parts still partition ma_gross_income with nothing dropped or double counted.
All eight new cases recompute by hand at head, and each differs on main. No +=, vectorized, changelog describes both changes.
Merge order with PR 9906: both rewrite ma_part_a_agi.py (textual conflict), and 9906's new ma_part_c_agi and ma_long_term_loss_against_dividends read long_term_capital_gains only. If 9906 lands after this PR without adding non_sch_d_capital_gains to those two reads, distributions drop out of the Part C base and cases 5 to 8 here fail. This PR does not move any value in 9906's tests, so merging this one first and having 9906 pick up the distributions in its rebase is the clean path.
Nits, not blocking:
part_a_and_c_incomeis a misleading name, since the comment says it is deliberately not Part A plus Part C gross income;filer_dividends_and_gainsor similar would read better.ma_part_b_gross_incomeandma_part_c_gross_incomecould cite the Form 1 instructions page for Schedule D line 6 in theirreference.
Pre-existing, for a follow-up: Form 4797 gains (other_net_gain) stay in Part B although Massachusetts routes them to Schedules B and D (instructions pages 25 and 27).
After #9954, Massachusetts Schedule D, line 13 includes capital gain distributions reported without a federal Schedule D (line 6). Read them in ma_part_c_agi and ma_long_term_loss_against_dividends too, so distributions stay in Part C and a long-term loss they cover is not applied against dividends on Schedule B, line 32. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g-term gains (#9906) * Apply Massachusetts Schedule B capital losses to dividends before long-term gains Schedule B line 20 applies a short-term loss first against up to $2,000 of dividends, and line 22 applies only the rest against long-term gains. Part A then taxes the dividends left (line 33). Part A taxable income used the gross dividends, and Part C subtracted the full short-term loss. Fixes #9905 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Apply only the remaining Massachusetts short-term loss to Part C gains Part C AGI added the short-term loss applied against dividends back to a Part C gross income that was already floored at zero, so a short-term loss larger than the long-term gain left too much Part C income. Schedule B, line 22 and Schedule D, lines 14 and 15 apply only the line 21 remainder against the long-term gain. Add cases with a long-term gain below the short-term loss, a combined $2,000 cap, and a 2023 case at the 8.5% rate. Label the new loss variables as applied against dividends and cite c.62 s.2(c)(2) and (4). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Count capital gain distributions in the Schedule B loss order After #9954, Massachusetts Schedule D, line 13 includes capital gain distributions reported without a federal Schedule D (line 6). Read them in ma_part_c_agi and ma_long_term_loss_against_dividends too, so distributions stay in Part C and a long-term loss they cover is not applied against dividends on Schedule B, line 32. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* Keep capital gains and losses out of Massachusetts Part B income ma_part_b_gross_income subtracted Part A and Part C gross income from ma_gross_income. Those net capital losses the Schedule B and D way, but irs_gross_income adds each filer's net capital gain floored at zero, so the difference stayed in Part B: a long-term loss against a short-term gain reduced Part B, and one spouse's short-term loss against the other spouse's long-term gain added phantom Part B income. Subtract the same dividend and capital gain amounts irs_gross_income adds instead (M.G.L. c. 62 s. 2(b), s. 2(d)(1)(M)). Fixes #9953. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Count capital gain distributions on Massachusetts Schedule D non_sch_d_capital_gains (Form 1040 line 7 distributions without a federal Schedule D) entered ma_gross_income through irs_gross_income but neither Part A nor Part C, so it stayed in Part B. Massachusetts reports them on Schedule D, line 6: add them to the long-term amount in ma_part_c_gross_income and ma_part_a_agi, and take them out of ma_part_b_gross_income. Fixes #9957. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Count Form 4797 gains and losses on Massachusetts Schedule D other_net_gain (Form 4797 line 18b, Schedule 1 line 4) entered ma_gross_income only through irs_gross_income, so a gain stayed in Part B and a loss was dropped. Massachusetts reports Form 4797, Part II amounts on Schedule D, line 7. Add ma_long_term_capital_gains for the long-term Schedule D amount (long-term gains, line 6 distributions and line 7 Form 4797 amounts), use it in ma_part_c_gross_income and ma_part_a_agi, and take other_net_gain_gross_income out of ma_part_b_gross_income. Also renames part_a_and_c_income to filer_dividends_and_gains and cites the Schedule D instructions in the Part B and Part C references, from the #9954 review. Fixes #9990. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: PavelMakarchuk <pavel@axiom.org>
Fixes #9953. Fixes #9957.
What changes
Capital gain netting (#9953).
ma_part_b_gross_incomenow subtracts fromma_gross_incomethe amounts thatirs_gross_incomeadded for dividends and capital gains: each head's and spouse'smax(0, dividend_income),max(0, capital_gains)andmax(0, non_sch_d_capital_gains). Before, it subtractedma_part_a_gross_incomeandma_part_c_gross_income, which net capital losses the Schedule B and D way, so the difference stayed in Part B:ma_part_a_agialready applies it on Schedule B, line 25.M.G.L. c. 62 § 2(b) puts all capital gain income in Part A or Part C, and § 2(d)(1)(M) disallows the IRC § 62(a)(3) loss deduction against Part B.
Capital gain distributions (#9957).
non_sch_d_capital_gains(Form 1040 line 7 without a federal Schedule D) was in neither Part A nor Part C, so it stayed in Part B. Massachusetts reports it on Schedule D, line 6.ma_part_c_gross_incomeandma_part_a_agi(the Schedule D, line 13 amount for line 25) now add it tolong_term_capital_gains. The two changes are in one PR because each is wrong without the other: Part B must stop subtracting Part C at the same time as Part C starts to include the distributions.Tests
gross_income/ma_part_b_gross_income.yamlhas eight 2023 returns, each computed line by line from the 2023 Form 1, Schedule B and Schedule D (wages 60,000; single unless noted):¹ The form gives 2,680. Main gives 2,680 only because this error offsets #9905; this PR alone gives 2,730, and this PR with #9906 gives 2,680.
All eight tests fail on main. The NBER TAXSIM-35
staxbcequals the form in rows 2 and 3. In row 1 it gives 2,815 (PolicyEngine/policyengine-taxsim#1399).All 661 tests under
gov/states/maand 746 other tests with Massachusetts households pass.Overlap
ma_part_a_agi(one line). Its newma_part_c_agiandma_long_term_loss_against_dividendsreadlong_term_capital_gainsand neednon_sch_d_capital_gainsadded too, whichever PR merges second.ma_part_a_agiandma_part_c_gross_income(one line each): keep itstax_unit_non_dep_addand addnon_sch_d_capital_gainsto the list.🤖 Generated with Claude Code