What is (legally speaking) a difference between "algorithm deducing how much you can pay" from taxi driver looking at your face and setting their meter accordingly to their feeling of how much you can pay? Is this legal?
Nothing, which is why taxi metering is set by the city/state, so it can't be altered (legally).
Except that cab drivers randomly setting their meters isn't a thing in any of the cabs I've ever been in, and I've lived in both NYC and London.
"Sorry my credit card machine isn't working" is usually the go-to line for on the spot pricing.
Try catching a cab in any developing asian nation. If you're white and not asking to go basically where they wanted to go anyhow, they'll just shake their head, say "no meter" and give you a highly inflated price.