In many cases an unthreaded shank provides a better, more secure fit when mating to the components that it connects. Where lateral movement is a concern, this type of bolt should be used.
In other cases, it's important that there be no pull on the upper portion of the material being joined. Threads would create drag that may counter the bolt's ability to bring two parts together with force.
There are two reasons that the unthreaded portion has the same diameter as the threaded portion. The first relates to what I mentioned earlier--a close-tolerance fit to the other parts of the system. If the threads were raised with respect to the shank (and some bolts are like this for various reasons), the bolt would be sloppy in the bore after insertion.
The other is more mundane--it's easier from a manufacturing standpoint. Threading machines typically remove material by cutting. This obviously leaves threads that have inner diameters smaller than the bolt's shank.