You don't need to pay to use Xcode, or to run apps on your own devices. If you publish to the app store I think there is a $99/year fee or something to have your app signed, plus they take 30% of your revenue.
You don't absolutely need to have your code signed, I can give apps to my friends, they just get a warning about it not being signed and potentially unsafe when it's first installed.