Unallocated disks will report their full capacity, because they are essentially empty--completely, for all intents and purposes.
Formatting implies that you partitioned and formatted the resultant partition. Formatting puts "stuff" (filesystem and directory architecture) in place on the drive (on top of the partition tables that you wrote to the drive in the earlier step), and all of that takes-up space on the drive.
That's the 'discrepancy' you are observing.
As an analogy, think of it in this way:
You buy a new 2-drawer file cabinet.
Before you put it into use, you label the drawers, and put hanging folder frames in place. Then you put some Pendaflex hanging folders on the frames in both drawers.
Before you've even put anything useful into the file cabinet, you have arranged the storage space into meaningful units for your future use.
Then you start putting file folders into the Pendaflex folders, each of which is intended to hold logically associated discrete documents, and is labeled to that effect.
You have functionally partitioned and formatted your two drawer file cabinet, and you have yet to store a bill, invoice, or finished document in it.
All of the foregoing takes up some of the storage space that you could have used for storing things, but it makes it easier to find things when you need them.