The last paragraph is perfect but the bolded paragraph is where you've gone wrong. Apple is not charging $199/$299 for the iphones. Apple are charging AT&T considerably more (and is where Apple are making a profit themselves on the phones), and AT&T are in turn are subsidising and selling the phone at $199/$299. The difference between what Apple charges AT&T, and what AT&T charges the customer, as you quite rightly point out, is made up (with a profit) over the course of the contract with AT&T.
Well why is the price the same when buying from an Apple store or buying from an AT&T store?
Do they sell the phone to AT&T first, then AT&T turns around and gives the phone back to Apple for selling in their stores, but makes up the difference on a contract? For every phone Apple sells in their store, AT&T has to give them money?
I've gone cross eyed.
From my understanding, Apple has decided to start charging less for their phones to make them more affordable.