Don't we already weigh trucks as they enter and leave the state, as well as sometimes in the middle of the state? I don't know what goes on there already, but we could certainly charge trucks based on loaded miles in the state, which should be pretty easy to calculate since they have very predictable driving patterns and take fairly detailed logs. For local deliveries, we could just charge based on the max load and allow drivers to prove anything otherwise.
And yes, consumers will pay regardless, but at least the difference is reflected in the cost of goods. It could very well be that certain local goods are cheaper than imported goods after road costs are properly factored in, which could change how much is imported.
However, this feels a bit regressive since poorer people will pay more of the cost since roads are largely funded by income tax, but that can be accounted for by shifting other taxes. The idea isn't too punish poor people or shipping customers, but to allow the market to work more efficiently.