You are correct in your thinking of what you would have to pay in order to upgrade. Turn the device back in, in good shape, pay the remaining lease payments plus the tax and then upgrade.
We do it all the time at the store I work at. Mainly with people with iPhones on leases but not on iPhone forever.