Why is a freezer compartment on top of a refrigerator?

Its not always on top of it, sometimes on the side of it, sometimes on the bottom of it. Sometimes its a separate unit entirely from the refrigerated section.