Sometimes the law dictates it. However, it is more complex than that. Charging doesn't really sell electricity. It's a service, for which the actual electricity is often a small part of the cost -- as low as 3 cents/kwh wholesale.
Once the kwh are in your car, they are just kwh, and you use them to drive. So we definitely like to only pay for "what we get" which is kwh when we leave the station.
However, we care a great deal about how fast we get those kwh, and where we get them. And the station owner mostly cares about how many cars it can charge in a day, which is based on time. A large part of what they want to sell you is minutes at the charger. When you sit near the end of your charge, pulling only 20kw, you are wasting your own time and wasting the charger's time, as it could be feeding the next guy at 200kw. We get annoyed at a per-minute station when it only gives us 20kw -- cheating us! -- but it's our car that's refusing to take the power any faster, not the station.
So it's really a mix. But we also want simplicity of pricing. A real price, which would be a complex mix of the kwh and the minutes, would be confusing to customers and is more than they want to think about. And the kwh do change price during the day due to market demand. A very large part of that is the cost of transmission, which is under high demand at 4pm and minimal demand at midnight. For generation, the cost varies greatly based on where it's generated. Most generation costs the same all day, but solar and wind come with the sun and weather.
So there is no one right answer to please both buyer and seller.