This happens at the virtual memory management level in the operating system. When you store a memory card, the memory manager basically processes the file as if it were the swap space for the process. When you access pages in the address space of virtual memory, the memory mapper must interpret and map them to physical memory. When you cross the page border, this can lead to a page crash, and at this time, the OS must map a piece of disk space to a piece of physical memory and enable the display of memory. With mmap, it simply does this from your file instead of its own swap space.
If you need detailed information on how this happens, you must tell us which operating system you are using, as the implementation details vary.