Gas taxes are becoming less of this, though, partially because cars have become more fuel efficient, partially because some cars don't even use gas, and partially because the gas tax has not been raised since 1993 and so has not covered full road spending for a long time.
The most "fair" way to do it would be to charge according to road wear and tear, which would look something like axle load ^2 * miles driven, but this would be hard to implement and also widely unpopular with huge swathes of the population (truck driver is the most common profession in many states)
An important distinction between specific tolls per road and a general gas tax
is that a gas tax funds all roads, not the specific one you're driving on. A toll on a particular road is an informative signal to the market of which particular stretch of road you want to drive on, in theory allowing more "efficient" allocation of roads.