Lawmakers introduced bipartisan legislation Thursday that would eliminate a quirk in the tax code that has resulted in the families of lost soldiers facing sharply higher tax bills on their survivor's benefits. The families were the inadvertent victims of an attempt to prevent the wealthy from avoiding estate taxes.

"When it was brought to our attention that simplification of the tax in 2017 was having unintended consequences for our Gold Star families, we worked quickly and on a bipartisan basis to find a solution that is fair and will also offer retroactive relief for affected families," said Rep. Kevin Brady, R-Texas, the top Republican on the Ways and Means Committee.

Thursday's proposed legislation is a response to the tax hikes that military families have suffered on Defense Department Survivor Benefits Plan benefits — the taxes have shot up as much as tenfold or more in the last year.

The legislation was authored by Rep. Elaine Luria, D-Va., and dubbed the Gold Star Family Tax Relief bill. It would clarify that any survivor benefit provided by the Department of Defense or the Department of Veterans Affairs and going to the child of a fallen soldier would not be classified as "unearned income," a designation that means it is taxed at the higher level reserved for estates. Prior to 2017, the benefit was taxed at the surviving parent's rate. The bill has nine Republican and seven Democratic co-sponsors.

Spouses' payments through the Defense Department's Survivor Benefits Plan are offset dollar-for-dollar if they also receive payments through the Department of Veterans Affairs' Dependency and Indemnity Compensation program. In effect, getting the VA benefit, which is typically larger at just under $16,000 annually, means forgoing the Defense Department benefit, even if the surviving spouse qualifies for both, a situation referred to as the "military widow's tax" by critics.

To circumvent this, many military families have placed the Defense Department benefit in a child's name. However, the 2017 tax cut bill championed by the Trump administration, the Tax Cuts and Jobs Act, altered the formula for taxing "unearned income" received by children. Previously, it was calculated at a rate based on the parent's income. Under the new law, it is taxed at the rate for estates.

The tax code change was intended to prevent the wealthy from avoiding estate taxes, according to sources involved the reform's drafting, and nobody foresaw that it would ensnare military families too.