That is essentially correct, though the math was completely hidden.
The justification for higher contract rates was because they were using that difference to subsidize new phones whenever you signed a new contract. So, 80 bucks a month for basic service and a few hundred MB of usage.
The problem was that after the 2 year contract ended, when they supposedly were able to recoup the cost of the original phone subsidy, your rate never changed. You'd still pay 80 bucks a month, even if you were happy with your current phone.
T-Mobile's change, much like the rest of the world, was to break out the math explicitly like you show. Then once you've fulfilled the (PRICE_OF_PHONE / CONTRACT_DURATION) term, it would simply vanish.