Often, townhouses are cheaper than free-standing houses, or single-family homes, as they're known in the real estate biz. Sure, once you buy a townhome, you'll be paying a mortgage and HOA fees, while your friends in a regular house are only in for the mortgage. But you know what else they get? A yard full of weeds, a driveway full of snow and a roof full of leaks. Who wants an HOA now, huh?
Townhouses are usually, but not always, multilevel affairs that share a side wall or two with another townhouse. They can have as many bedrooms and bathrooms as will fit in the floor plan, just like a single-family house. They can be close in to the city center, or they can be out in the 'burbs surrounded by vineyards or forests. The point is, you can get a lot of the same stuff in a townhouse that you can find in a regular house but you typically pay way less for it.
Sometimes you can actually find better stuff in a townhouse -- that is, if you're willing to share a wall or two. Townhouses are often newer than single-family homes that are on the market, so the floors and walls won't slope like a funhouse. Townhouses sometimes have the fancy upgrades built right in that you otherwise couldn't afford in a house, like granite countertops and high-end stainless steel appliances, or hardwood floors, or eco-friendly materials like cork and bamboo.