Congress is operating at a level of dysfunction that hasn't been seen since 1923, which makes it all the more striking that the same legislative body was able to pass a $1.7 trillion law supporting green energy - quietly, with little fanfare.

The Consolidated Appropriations Act of 2023 will shower billions of dollars on clean energy programs - a record - to boost the sector. Any law that does that is controversial.

But what matters from an investing perspective is this: Exactly two years before - and also in the dead of night - President Donald Trump signed a law that was similarly heralded as "the most significant climate legislation in over a decade." And clean energy stocks soared in the months that followed.

Tesla Inc. (TSLA  ) stock surged enough to add $100 billion to its valuation. The Clean Edge Energy index Fund jumped 19% the following month. Electric vehicle maker Nikola Corp. (NKLA  ) shot up 74% in the same time frame. Or as Bloomberg put it in a headline, "Fuel Cell, Solar Stocks Surge on Covid Bill, Capping Banner Year."

Now, billions of dollars are about to flow into clean energy companies again. What will this mean for investors in 2023?

It's been 14 years since another clean energy law, President Barack Obama's 2009 stimulus bill, awarded one little-known car company a $465 million loan and "created Tesla as we know it," according to Bloomberg. In the years since, Tesla has returned 7,500% - even taking into account its recent selloff.

But investors should be wary of chasing past performance and betting exclusively on past industry leaders. As government agencies move to aggressively lower barriers to entry, major openings for newer industry players are emerging.

For example, the new law allocated $3.46 billion toward improving the energy efficiency of buildings. That's a big potential opening for startups like Airthium, a startup focusing on sustainable energy, and other innovative green-energy startups. Clean energy has already created fortunes for investors who successfully play the trend, as any Teslanaire can tell you. But the revolution is only accelerating. Billionaire Chamath Palihapitiya has predicted clean energy will create the world's first trillionaire. With a record $1.7 trillion now on its way to green energy companies around the U.S., that certainly might be the case.