There's not necessarily a difference with regard the medical application, but it's more to do with consistency.
Creams are water-based and have a thickish consistency; lotions are also water-based but tend to be thinner and are less likely to be medicinal (they are usually cleansing-type products); gels are jelly-like coagulated water-based products and ointments are oil-based.