Actually residual value is the computed net market value of the car after a period of time. It can be calculated from the sticker, but more likely is calculated based on a complex formula that is keyed to resale value. What you are quoted as the price of the car isn't an issue. Toyota announced today (according to the Wall St. Journal) that it will be increasing he residual on many models. This is a way to lower the monthly lease cost. Residual can also be set arbitrarily for promotional reasons.
Economic theory aside... I believe the OP's question was whether residual was based on MSRP or selling price. For Toyotas and BMWs (which I can say definitively) and likely for other manufacturers, it's based on the MSRP, and not on how well you negotiate the selling price.