In the US most phones are bundled with a service contract (typically two years). This reduces the line item price of the phone from list price to a fraction of list price (or zero). However, if the contract is terminated early, the balance of the list price is due. In addition, if a smartphone is bundled with the service contract, the purchaser must select a plan which includes data service.
ATT makes additional revenue by charging the same rate if you have bundled a phone with your service plan or if you are using your own unlocked GSM phone.
Tmobile, the other significant GSM carrier in the US provides a $20 a month discount for (and does not require a service contract) when the customer does not bundle a phone with their plan.
In the US ATT is the exclusive iPhone carrier and unlocked GSM iPhones are not available. Thus the price of the iPhone is $49, and it's cost over the course of a 24 month contract is $899 because of the terms required by ATT's standard agreement.