Basically non t-mobile, verizon or whatever stores are independent stores. They buy a phone, say for $500. Then a contract gives them a spiff for it, say $250. So the store charges you $300 for the phone and makes $50 off the sale. IF you terminate the contract with t-mobile or any of these companies before your contract is up AT ANY TIME, that $250 is not paid to the store, or is deducted from what the carrier owes the store. Basically the store (like google) MUST charge you $250 or they lose more money than they made off of your sale.
This is why the little cellphone stores make you sign similar agreements. Now how the company recoups the "price of the phone" by early termination fee, I don't know. The fee is pure profit for the carrier.