Unfortunately in many jurisdictions it is legally required to do that when passing a pedestrian.

Can you list some examples? When I lived in Chicago it was quite common for cyclists to shout this on the long lakefront trail, I wonder if that's the case there too.