My MasterCard is 2% cashback (through points, but that just means I batch it), but has an annual fee of $150 for two cards, and a minimum household income. I need to spend $7500 on the card just to break even, but if I funnel nearly all my expenses through the card I can net $1000 or more a year.
These "rewards" come from the merchant, in the form of higher fees, and because the merchant can't discriminate prices between credit/cash (probably in the CC t&c somewhere) then if the merchant wants x% profit from me, they're earning >x% from someone paying cash.