The people who live outside the city are able to find employment too. It’s a myth that jobs are only in the cities. Especially so if you work in tech and can do remote work.
That’s what brings these cost of living averages down - the people not living in big cities whose expenses are less.