Converting a plane from a passenger jet into a cargo plane is far cheaper than buying a new plane, so that's why you see freight planes with window outlines and other features that look like passenger planes.
Though it's not the case that a plane carries either passengers or cargo. The US Postal Service leases space on about 15,000 of the 25,000 or so passenger flights scheduled each day. And some flights can even be configured such that half the cabin compartment holds people and the other half cargo.
But there are planes built specifically for cargo, largely to support the increasing demand for worldwide shipping. Some basic models come from the factory ready to haul as much as five semi-truck's worth of cargo.
There are some interesting specializations out there too. The door on cargo planes, for example. Most have the traditional cargo doors that we see on passenger jets though cut into different parts of the plane for the sake of cargo loading, but for bigger loads there are special doors.
For more epic stories of innovation that shaped our future, check out TheAgeofAerospace.com.