The enlightened big brain politically impossible is to internalize as much as possible. For example, everyone could have a device on their car that records how much carbon they emit and reports it to the government so they can be taxed. The amount they should be taxed is not trivial to determine, but an upper bound would be the cost of offsetting or capturing the same amount of carbon they emitted. (you don’t actually have to spend it on that, the point is just to incentivize people to avoid emitting carbon)
Then increase train fare so it’s at least as expensive per-carbon-emitted as driving. Since trains emit much less carbon, it will end up being cheaper to get from point A to point B by train.
Driving or taking the train has another cost, congestion. (more drivers means it takes everyone longer to get to where they’re going, more riders means some people might not be able to fit on the train. that second one used to be a common occurrence to me.)
Now that might seem hideously unfair to poor people. The solution is to take all the revenue collected this way and redistribute it throughout the jurisdiction where the law is enforced. The poorest would actually see an increase in their purchasing power. That’s because poor people emit less carbon on average, so if e.g. a poor person emits 1 ton per day and the average is 2 tons per day (making up numbers), they would pay the tax cost of emitting 1 ton but receive the tax cost of emitting two tons. The money would come from wealthy people who emit 3 tons but only receive the cost of emitting 2. That way everyone is incentivized to emit less without it unfairly burdening the poor.