Back in the day if you wanted to develop for PalmOS you had to pay Metroworks (IIRC) $~300 for their CodeWarrior C++ compiler, so the fact that XCode is free is a pretty big improvement.
XCode is not free, just like macOS is not free; you just pay for them when you (over)pay for your mac hardware.