One useful data point is that pretty much anyone can set up a google checkout account to accept credit card payments with a 2% commission (plus a small fixed per-transaction fee). That means if you really wanted miles/points, you could always pay yourself through google checkout, at a cost of $.02 per dollar charged.
So basically any time I can get more than 2% cash back (in particular restaurants with the AMEX Costco 3% card), I always go for the cash. Otherwise, points. Also, if there's some promotion in which I'd be paying for something to get points, I won't even consider it unless the effective cost is below $.02 per point.