In Japan there are high beer taxes - so the average can costs 3$ US. Someone realized that because of the way the tax laws are written, it's possible to create a drink which sort of tastes like beer, but which doesn't technically qualify to be taxed that way. They called it "Happo-shu", and it costs about 1$ a can. It doesn't taste very good, but it's really popular.
The actual cost of a can of beer is probably 25 cents in terms of resources (natural & human), and happoshu is probably about the same, or more (because nobody made it naturally, and because the production process has to avoid the natural ways to make a drink like that, which produced beer). That price represents how much resources and expertise it takes to produce. Both drinks take about the same resources to produce - but one is better than the other. But the law has resulted in all those resources being put into making the worse product.
Say someone starts out one day and decides they are going to take raw materials, hire smart people, and produce something valuable, and sell it. It's really perverse that the law now would give them incentives to produce the worse product.
At some point Beijing decided that they didn't want to be a motorcycle city, they wanted to be classy and have lots of cars. So they stopped issuing motorcycle license plates. Old motorcycles are still allowed to drive around, and you are allowed to sell your license plate, so the prices for those just went up and up. Bicycles are still ok - although a lot more annoying to ride since cars are allowed to park everywhere in the city, and bike lanes are the perfect parking spot.
Someone stuck an electric motor on the side of a bicycle, which let it go about 20 mph. These got better and better, and now everyone rides them. They're kind of inconvenient, cause you have to carry the battery inside every day to charge it, and people always try to steal the battery, and they don't go that fast, and they're kind of bulky... But now most people who would have ridden a motorcycle before now ride one of these. Carrying 40 pounds of battery around all the time instead of a gallon of gas (6 lbs) is kind of inefficient, too. And you can't recharge on the go, or leave the city - and occasionally you run out of power and there's no way but to slowly pedal it home (or be stuck out).
There's also the question of the efficiency of getting the electricity into the battery - electricity isn't free, and it doesn't come out of the ground pure. Powering the electric grid causes pollution and uses resources, too - it's not a simple contrast between dirty gas and clean battery power. And millions of cars are allowed to idle in huge traffic jams throughout the city every day, too.
The plan to get lots of cars in Beijing has succeeded - now the ring roads are utterly packed every morning and evening. Taxis have stopped working during some hours cause they can't make any money always being stuck in traffic. And ebikes are again the fastest way to get around.
But basically a whole class of transportation is now slower and worse because of a law. Other cities in China still allow motorbikes, and people drive them everywhere there still, just as they have before.
The stupid particularities of the law, which taxes good-tasting things at a higher rate than bad ones, are what makes this happen. The same thing would happen if you taxed comfortable chairs really highly, and uncomfortable chairs not at all - pretty soon everyone would sit all day in uncomfortable chairs!
So one avenue would be to say that each class (and class must be defined really generally) of thing can't be taxed at different rates - because if you try to tax one "natural" class of object at a high rate, people will try to make "unnatural" versions of it to escape the tax. (By unnatural I mean, wouldn't exist in a world without taxes - horrible tasting fake beer, or ebikes)
But I think it'd be quite hard to keep legal discipline so that this type of thing didn't happen. And the above situation is probably happening everywhere - people going through huge contortions and wasting their capacity and resources to change the way they appear under the law, rather than using that same thought to do something actually good.