The way you collect the tax is having owners report the odometer reading at vehicle registration renewal. Tax is based upon miles driven and the weight/class of the vehicle. Place a huge penalty on incorrect reporting odometer readings and check the reported numbers when the title is transferred. Feds get a portion of the tax and states get the other portion.
The problem with all taxes is the intended use of the money is often not how it is spent.
The other options are to use electronic tolling on most roads or let the roads and bridges continue to decay.