The line sits at four units and it's a lending definition rather than anything about the building. One to four units is residential for loan purposes, which means the loan is underwritten mostly on you, your income, your credit, your reserves, with the property's rent helping. Two units is a duplex, three a triplex, four a fourplex (some markets say quadplex, same thing). At five units and up the loan is commercial: underwritten on the property's income, usually a bigger down payment, a shorter term with a balloon, and personal guarantees.
So a fourplex can qualify for the same kind of low-down-payment owner-occupied program a single family house does, if you live in one unit. The five unit next door can't, even if it's physically identical with one extra bedroom walled off. Terms move around, so get the actual numbers in writing from a lender before you fall in love with a building.
One thing that catches people with your background especially: the count that matters is legal units. If a "fourplex" is really a triplex with an unpermitted basement apartment, the appraiser can count three, and that fourth rent may not be usable in underwriting at all. Whether the unit can be legalized depends on your local zoning and building code and how your state treats existing nonconforming use, so that's a question for the city and, if money is riding on it, a local land use attorney.