If it is uncountable stuff, like water or sugar:
How MUCH of this did you buy?
If there are 10 books in front of me, and I want to know if you bought 3 of them or all of them:
How many of these did you buy?
If there is a list of different types of objects (for instance, red bottles, black bottles, green bottles, etc) and I point to one item on the list (say, red bottles), I could either ask
How many of this did you buy?=How many of this type of bottle did you buy?
OR
How much of this did you buy?=How much money's worth of this did you buy?
OR
How many of these did you buy?=How many bottles did you buy?