The early computer engineers chose to adopt, and adapt, SI prefix units to their data counts. These are the same prefixes, but counting using binary rather than metric. Since 2^10 is close to 10^3, then each SI prefix normally increasing an amount by 10^3 instead refers to an increase of 2^10:
Prefix Metric prefix Binary prefix Difference
k kilo 10^3=1,000 2^10=1,024 2.4%
M mega 10^6=1,000,000 2^20=1,048,576 4.9%
G giga 10^9=1,000,000,000 2^30=1,073,741,824 7.4%
T tera 10^12 2^40 10.0%
P peta 10^15 2^50 12.6%
These were adopted as part of the JEDEC standards.
This has a number of benefits since a lot of work in this field happens in powers of 2. However as you can see they diverge from metric, and since we are now dealing with larger amounts of storage where the difference between the two diverges significantly the problem has been dealt with by IEC and NIST. These differentiate the two systems by changing the binary prefix:
Prefix Binary prefix
ki kibi 2^10
Mi mebi 2^20
Gi gibi 2^30
Ti tebi 2^40
Pi pebi 2^50
These were first standardized in 1998, and adopted into the International System of Quantities in 2008, but adoption is slow, and there are still companies creating new documents using the old standard. Where companies have switched, they've found users confused and some have switched back to the older style.
Thus, using the older standard, 4Mb is 4 * 2^20 bits, which is equivalent to 512 * 2^10 bytes.
Represented in the newer standard, it would instead be 4Mib = 512 kiB, assuming 'b' is bits and 'B' is bytes.