These are the exceptions. Most of the time you are better of buying the car via a loan.
1) If the lease rebates far exceed the loan rebates. You can crunch the numbers and see which way will cost you the least to own the car outright.
2) If the lease isn't worth the residual value at the end, but you convince the dealership to buy it and sell it back to you for a reduced price. This may not work depending on which brand you buy. It would be a good idea to ask the dealership before leasing if the financial institution (toyota financial, gm financial, ford motor credit) they are using allows them to buy the vehicle for "market value" at the end of the lease. In nearly 100% of the Cadillac sedan leases I have done, the car isn't worth the residual. I can sell the car back to the customer for less than the residual in those cases.
Sometimes the interest rate on the lease is less than what a 60 or 72 month loan would be. That's why the question can't be answered simply. You have to crunch the numbers both ways.