The upgrade to newer OS X versions is free. So ...
It's free, but only after you pay for new hardware.
I finally had to buy a Mac mini just so I could do iOS development. But every Mac I buy now, I just have to plan on running Linux on it in a few years.
https://www.apple.com/osx/how-to-upgrade/
If you only had Leopard you had to spend $20 to get Snow Leopard first before getting the update to Mavericks.
Edit: I should say that not all Snow Leopard machines can be upgrade to Mavericks, a bunch of the 2006 models can't.