After a lot of digging I found a workaround.
What works: call e.g. ipapi.co on the client side
import anvil.http
try:
data = anvil.http.request("https://ipapi.co/json/", json=True)
client_country = data.get("country_code")
except:
client_country = None
Then pass the country code to the server if needed.
What does not work: anvil.server.context.client.location on the server side. It provides seemingly random results that show a remarkable stickiness. The results seem to have no correlation to what the client ip adress actually is, and they change only when I restart the computer. Testing with separate windows and another computer, the location returned by anvil.server.context.client.location never changes on a computer even as I switch location via VPN, switch browser, or go incognito. Testing on another computer, I get another location (this time in Czechia), but it remains the anvil.server.context.client.location until I reboot the computer, after which I get a location in the US although my VPN has me in Belgium and client side correctly detects that. As far as I can tell, anvil.server.context.client.ip is correct.