Nearly 10 years after Congress passed billions of dollars in funding with no expiration date for rail boondoggles, American taxpayers have received a fresh reminder of how their hard-earned money has gone to waste.

On Tuesday, the Federal Railroad Administration issued a notice of intent to end a grant agreement funding California’s high-speed rail project. This came a week after California Gov. Gavin Newsom announced that the state would be massively scaling back construction, which was initially supposed to link San Francisco to Los Angeles.

The debacle dates back to 2009. With the economy in the throes of the Great Recession, President Barack Obama and congressional Democrats pushed through massive amounts of spending.

Much of this took the form of a massive (and poorly designed) stimulus package, while hundreds of billions more were spent through the annual appropriations process.

Among the dubious decisions in the stimulus was $10 billion in grants to state and local governments for rail transportation, of which California ultimately received $2.5 billion. Following that, another $929 million was granted to California for the project as part of regular funding of the Department of Transportation.

Due to the way in which stimulus funds were time-limited, the $2.5 billion was distributed relatively quickly. In contrast, the other $929 million is still “obligated” for future stages of California’s high-speed rail project.

The Federal Railroad Administration’s notice on Tuesday sets the stage for clawing back that $929 million, since it has not yet been used.

California will likely sue the federal government to keep that money, but the Federal Railroad Administration has strong grounds for taking it back.

California’s high-speed rail construction was already running well behind the agreed-upon schedule before the governor announced the massive scale-back. His announcement meant that the original route will not be completed. Since California is unable to hold up its end of the agreement, it would seem reasonable for taxpayers from coast to coast to no longer be responsible for giving it the $929 million.

But the federal government is going even further. The Federal Railroad Administration’s notice also mentions that the administration is “exploring all available legal options,” including “the recovery of the federal funds expended,” meaning it would try to retrieve the initial $2.5 billion.

In a similar vein, President Donald Trump recently called on California to return the $2.5 billion it had received from federal taxpayers to date.

Clawing back the $2.5 billion in stimulus funds from California would be a much more ambitious undertaking than sticking to the $929 million. California already spent the $2.5 billion. Once funds for a grant are authorized by federal law and spent by the grantee (in this case, California), it’s hard to imagine a court ordering a return of that money after the fact.

Hence, the Federal Railroad Administration is merely “exploring” its options. It hasn’t yet made a decision.

Regardless of the final outcome, this ordeal is proving to have been a wasteful mess. Lawmakers should take it as an object lesson and begin to change the way they spend money on projects. Here are two things in particular that need to change.

First, the federal government should not be used as a piggybank for state and local politicians.

Even if the California high-speed rail project had gone smoothly, it still would have provided no benefits to taxpayers in the other 49 states.

Congress is an inefficient allocator of money for local projects. Instead, state and local governments should live up to their own responsibilities and allocate funds to meet their own needs. This would allow Congress to better focus on core constitutional duties like national defense.

Second, Congress should severely limit the practice of open-ended or “no year” funding, which puts no deadline on when allocated funds have to be spent.

The $929 million that will likely be clawed back by the Federal Railroad Administration comes from a spending package that was signed into law on Dec. 16, 2009.

If California loses the $929 million, that money will not be used to improve the nation’s shaky fiscal situation. Instead, because the funds have no time limit, they will be made available again for grants to rail or anti-congestion projects.

It is absurd that the final destination of such a large amount of money is still up for debate. In theory, California could even get the money back.

Funds left unspent after several years should be rescinded and used for deficit reduction. Congress should take steps to ensure that agencies make good-faith efforts to spend what is required by law, and then make sure excess funds are returned to the treasury upon reaching the spending deadline.

With America $22 trillion in debt, we need responsible leadership and leaner government right now.