The difference in capacities is due to two different methods for defining what exactly the prefixes mega, giga, tera mean. In the computer world, these prefixes have different meanings depending on what exactly you are talking about. Hard drive manufacturers report the size of hard drives using the decimal definition of these terms (10^6, 10^9, 10^12 resepctively), whereas operating systems and other software use the binary definition of these terms (2^20, 2^30, 2^40).

As you can calculate, these values are close, but not exactly the same. 10^6 is 1,000,000, but 2^20 is 1,048,576. Once we get to larger hard drive sizes, the difference really becomes noticeable.

One gigabyte in binary is 1,073,741,824 bytes (2^30), but in decimal its only 1,000,000,000 bytes (10^9), which is a difference of 73,741,824 bytes (~70MB). So, when we're talking about storage size in gigabytes a hard drive's capacity as reported by the OS will be about 7% less than what is advertised by the hard drive manufacturer.

One solution to this is to talk about computer storage using Binary Prefixes so that there is no confusion about the exact amounts being talked about. In that system, a Gibibyte (GiB) is always 2^30 exactly. But, I wouldn't expect storage device manufacturers to adopt this method any time soon.