It depends. Some exercise classes can be expensive, yes. But alot of the time they have deals if you join during a certain period or if you bring a friend to join the classes with you.
Cardio exercise equipment, such as stationary bikes, treadmills, and elliptical machines, varies widely in price. You can get a cheap treadmill for $150, or a used bike for less.
Some exercise classes focus on building muscle mass, like weight lifting. Others focus on cardiovascular exercises that burn calories for weight loss. Those are sometimes called aerobics.