The San Francisco Marathon (for 2019) costs $233 to register for the full marathon, and about $143 for the half. It's definitely overpriced here.
I mean, presumably for every New York Marathon and Boston Marathon, there are 100 less famous events that can't command such a high price?
But to your point, there are many smaller races that are cheaper. But often these are less organized, fewer road closures, less exciting, fewer perks; you get what you pay for.