Both count, and the thing they share is the mechanism: you buy a property, live in part of it, and rent the rest so tenant money reduces what you pay for housing. Your cousin is doing the rent-offset part without having bought the house for that reason, which is why nobody calls it a strategy. The label attaches to the intent at purchase, so you're buying a property partly because of what the extra space can earn.
Where the forms genuinely differ is in what the lender does with them, and that's the distinction worth holding onto.
On a two-to-four-unit purchase, the property is legally multiple dwelling units. The appraiser produces a market rent schedule for the units you won't occupy, and the lender can count a portion of that projected rent toward your qualifying income. You haven't met a tenant yet and the income still helps you qualify. Same for a permitted accessory dwelling unit under the newer Fannie Mae approach, up to a share of your total qualifying income.
Roommate rent in a single-family house usually gets no such treatment. There are no separate units, so there's no rent schedule, and lenders generally won't count money from someone sharing your bedrooms toward qualification. You still get the cash flow once they move in. You just don't get help clearing the approval.
So the loan product and the property type are doing the real work, and the intent is what makes it a plan rather than an accident. If your goal is to qualify for more house, the unit count matters. If your goal is to lower a payment you already qualify for, a spare bedroom does that fine.