As mentioned, it's all about how much the warranty is and what is covered. When I bought my '11 pro-4x it was a lease return with only the 5/60 powertrain warranty left. I was offered an extended powertrain warranty for I think it was $1200, it was going to add minimal to my monthly payment (20 or 30 dollars a month) The warranty was going to take me to 100k miles which is 40K more miles than the powertrain warranty. I figured a rear locker, a transfer case, auto transmission or engine repair was well over $1200 and it was worth it to me. At 66k miles, my rear locker went out and all I was out was the $100 (or $150?) deductible on a $4400 part.... I won that one. Had the warranty been more or covered fewer miles, I wouldn't have got it.
Similar situation with the used Honda Pilot my for my wife. I forget the cost, but again, it was going to take us past 100k miles, added minimal to the payments. I did sit with her in the finance office and turned down many $$$ worth of add ons, accessories and "Service packages" Knowing as the OP mentioned, that's where they were making their money.
A blanket statement like "don't buy an extended warranty" isn't 100% accurate. It is a gamble, one just needs to weigh the risk before rolling the dice.