You only need 24 bits of memory to store 10 million miles. 9,999,999 miles in decimal is the same as this in binary:
100110001001011001111111
So a single 32-bit memory location would store far more miles than the car would ever move. Counting in binary looks like this:
0 = 0
1 = 1
2 = 10
3 = 11
4 = 100
5 = 101
6 = 110
7 = 111
8 = 1000
9 = 1001
10 = 1010
and so on and so on. You could store 1.6 million miles in 24 bits space. The tenths could be stored separately, but that depends on how the number is defined by the program or the hardware. My guess is they store the odometer and trip meter mileage to NVRAM once per ignition cycle. Modern NVRAM chips can be expected to last about 100,000 writes. 100,000 ignition cycles would take a long time to accumulate.
If voltage is removed from the PCM, there may be enough reserve in capacitors or a small battery to commit the mileage from RAM to NVRAM. The exact circuit probably depends on the manufacturer, but it doesn't take much memory at all to store the mileage. There are plenty of other things to be stored in there as well like learned idle values, transmission shift points, TPS and crank/cam position sensor calibration values, and the list goes on and on.