Really, it boils down to one thing:
Money
AT&T has something made by Apple (and a decent product, at that) fanboys are going to spend whatever they have to to get that shiny Apple logo on their phone. Once other people realize that the iPhone was an easier smartphone, and better looking than a BlackBerry, they're going to switch to the iPhone regardless if they have Verizon, T-Mobile or Sprint. So there's more money in the pockets of AT&T & Apple.
Apple has contracts with a bunch of different carriers to carry the iPhone. They know they've made a product that many people can't live without, so they know if someone wants it, they're going to shell out the cash for it.
Personally, I think the iPhone is garbage. Well, not garbage. It's good. And I like a lot of the features. I just don't like the restrictions it has. I much prefer Android to a bastardized version of OS X. But I'm a big open source snob, so I'm a little biased.