Tax is always charged base on the full price of the product.
Other people brought this up, but why isn't the retail price of the phone reduced when you're trading in a phone, thus lowering the sales tax liability? So if I buy a $800 phone, of course I pay tax on $800...if I'm buying a $800 phone and there is a $200 discount or coupon I pay tax on $600. But if there is a $800 and I trade in my phone to lower the sales price to $600 I'm still forced to pay tax on $800. Seems like it's more beneficial to the consumer and Apple if they discount the cost of the phone at time of purchase and not post-trade in. This is exactly how car sales work and it's a great way to reduce the overall costs to the consumer.