Why do networks lock their iphones to their network only?

Okay, I'm a little pissed off. I bought my iphone used, and it is locked to at&t, and my previous phone uses Verison. I took the sim card out of my old phone and put it into my iphone, and it says my iphone is locked. That just really pissed me off, cause I paid for the phone, and when I went online to find out how to unlock it, they have to charge me. I mean WTF its my phone, I paid for it, and there for I should be able to do whatever I want with it. Please no mean answers.

Added (1). Haha I got it a few months old, from my cousin who lives in Virginia, and she sent it to me via mail, and I sent her something of the same value LOL

The phone was on a contract to someone, or on a prepaid. The companies sell phones a bit cheaper, but they need to keep your loyalty so they lock the phone so you will keep using their network.
IF the phone is over 2 years old, go to an at&t store and see if they will unlock it for you, or sell it to someone who likes at&t and this time, check that your sim works before you pay for it

Well you see the way it works is, you have a mayjor company like telstra, and a small retail store.
Now, the retail store can only afford to buy lets say 500 iphones per month max, thats their budget. As a result, they pay a hypotetical $550 to apple per phone, normal price being $600 but for 500 they get a discount for buying in bulk.
Now telstra on the other hand is all like, hey, we have a massive budget, lets buy 5 million, get it discounted down to $200 per phone. They have to make a profit however so it goes up to likely $400 for profit and to cover additional costs.now, the small store will think hell yeah, ill buy 500 for 400 from telstra instead of 550 from apple.

Now, telstra, as a middle man makes very little profit out of this because they also must endorse the warranties, and pay heaps of taxes and other stuff. So hey, why not completely destroy our profits to get all sales, but lock our phones to our network for like 2-3 years forcing customers to buy credit.already per phone, even if we make no monye, or even make a small loss, 1 person will pay at least $240 in credit per year and maybe as much as $6000 per year, to our ocmpany because its locked to our network. Thats a guarantee of credit sales to their own company.

Its like the prepaid equivalent of a plan where you get your phone for free. Its a gamble they make because they know your gonna buy credit eventually. On average if you can afford the iphone youll buy like 30-40 in credit at a time. And credit is way overpriced telstra makes huge profits.

personally i believe that the phone companies make a small profit reselling the phones, but only small. Now, not to sound mean but you must be pretty stupid to buy an iphone locked to a network you don't use. I mean, on ebay for instance, it says in the description if its locked or not, in which case, youve read it and consciously make the choice to buy it with said lock. Now, if not, that is, you bought the phone advertised as unlocked and got it locked, then return it, your within your rights, get your money back and buy elsewhere, that says its unlocked.

If the contract is paid off then they will unlock it if you call them.