Congress should bite the bullet and raise the gas tax to fund highway repairs and construction, and it should make sure highway taxes are used for the roads, not to finance politicians’ pet projects and line union pockets.

The Federal Highway Trust Fund was established in 1956 with a 3 cent gasoline tax to finance the construction of the Interstate Highway System and federal contributions to other projects undertaken with the states.

The gasoline tax was last raised in 1993 to 18.4 cents per gallon and is supplemented by a 24.4 cents diesel tax and levies on truck tires and other assorted fees on trucks and trailers. However, one quarter of these highway use taxes are tapped off for other purposes—about 15 percent for mass transit construction and the remainder for bike paths, recreational trails, scenic overlooks and other noble purposes.

Initially, the fund built up a surplus, but spending has outpaced revenue since 2001. Since 2008, the fund has been teetering on insolvency, and Congress—reluctant to raise the unpopular gas tax—has passed 34 temporary trust fund extensions and funding patches.

If Congress does not pass a new funding measure before it adjourns for its August recess, the fund will be out of money to finance badly needed highway maintenance and new projects.

To keep it going another three years, Majority Leader Mitch McConnell and California Senator Barbara Boxer have crafted a bill that includes 15 separate funding sources including sales from the strategic petroleum reserves and cutting the dividends banks receive on their paid in capital to the regional Federal Reserve banks. Unrelated to highway use and benefits, many of those revenue raisers have attracted opposition in both houses of Congress.

Going forward the Trust Fund will spend about $50 billion a year, and taxes on fuel and commercial vehicles only generate about $35 billion. The McConnell-Boxer fix is temporary at best—for example, only so much oil can be sold from the strategic reserve.

More importantly, the fuel taxes do not rise with inflation, Americans are using less gasoline, bigger trucks put more wear and tear on the nation’s roads, and the Interstate Highway System and other federally assisted projects are aging—some 60,000 bridges in the United States are structurally deficient.

Gasoline usage has declined since 2007, because vehicles are becoming ever more fuel efficient, an aging population drives less, and Millennials prefer to live closer to jobs and use mass transit more.

Moreover, a lot of the money is misspent or badly spent. In addition to tapping off highway money for subways, bike paths, and the like, the “prevailing wage” provisions of the Davis-Bacon Act generally requires excessively high union wages and cumbersome work rules on federally assisted projects—no matter that unions represent less than 7 percent of private sector workers.

One solution offered to deal with rising vehicle fuel efficiency is to levy the tax on the basis of miles driven instead of fuel consumption, but that would require tracking cars with GPS devices, the Internet. or some other method that raises privacy issues. Moreover, as opposed to a per gallon tax, a mileage based system would discourage conservation and reward those who chose to drive around town in 5,000 pound SUVs.

To fix the highway trust fund, Congress should stop tapping it for other purposes—tax mass transit rides to finance the federal contribution to new system construction and improvements; impose an excise tax on bikes, tires, and repairs; and raise national park fees to finance scenic overlooks and outdoor recreational projects.

Along with canceling Davis-Bacon so that we get our money’s worth from highway dollars spent, making up the difference by raising the gas tax and then indexing it to inflation makes good environmental sense and is the fairest policy.

Mr. Morici is an economist and business professor at the University of Maryland and an avid biker. He tweets at @pmorici1.