Gas tax already doing this
But not for these magic electric vehicles they are mandating. Solution - use the inbuilt GPS capability that electric vehicles all seem to have to collect mileage*, and bill the owners' credit cards automatically. Let the gas tax take care of the rest just as it does now.
*I wonder how many Tesla owners have even a clue that they're being monitored every minute of every hour of every day.
I read a few weeks ago that you can't even boot up your Tesla if it can't see the mothership via Internet. Major problem if you're out of cellphone range. Is this why Musk started building-out Starlink?