Their income is from the two sources you mentioned - they charge the merchants for each use, and they make interest money on people who carry a balance.
This is one reason a lot of merchants will be willing to give you a discount if you pay cash - they don't have to give a portion to VISA or MasterCard.
I wouldn't be able to speak to the relative proportions between the two income sources, but when many cards are at 30% interest for balances carried, and many people have tens of thousands of dollars owed on their cards, the interest income is not insignificant. They'll also charge interest immediately on cash advances.
A few cards also make money off of annual fees, although I'd suspect this is not very much in the full scheme of things.
The way to get the most out of a card, is to always pay it off fully at the end of each month.