Sure they do - and they also sign you up for another 2 year contract! If they were losing money - you wouldn't be getting a 5+% dividend!
And remember that people are signing up for "data plans" for their iPads by the gazillions....
And remember that the "unlimited" data on your iPhone - ISN'T unlimited... if you read the fine print.
And remember - not everyone is going from an iPhone to another iPhone - there are MILLIONS of people that have yet to get a "smart phone" -- and smart phone plans are NOT the $9.95 el cheapo monthly --- the iPhone is like $50 bucks a month! So they're making money on that upgrade cycle.
It's all about the "up sale". Margins are better when you up sale!