Basically, if you owe 10,000 on a car that is worth 12,000, they pay off 10,000 worth of loan, and then you have 2000 positive equity towards the new car. This is the same as having a down payment, and in turn reduces your loan amount.
If you have negative equity, then they charge that to the new loan so you owe MORE than the original price.