SoMemory effectively controls hardware.
So at a low level, hardware is linked to memory locations. For instance in a simple micro controller, physical transistors to drive the pins are linked to memory bits. That is really what registers are in data sheets for hardware chips, they are memory locations. You set a bit in software and the physically connected hardware is activated.
Update (Software -> Memory flow):
To address how the code flows from code to memory: At some point a physical device is used to set voltage levels in memory bits based on the machine code generated by the compiler and linker.
i.e. your first byte of code is 0xAA. The software instructs a memory programmer (via JTAG, UART, SPI etc.) to select a 8 byte wide memory location (lets call it 0x0001). That memory location is then set to the voltage levels defined by the 0s and 1s (0xAA='10101010') using hardware. Upon boot, hardware is hard wired to load a specific memory address into the CPU register and start running from there. If you were to open the memory chip up, and probe the silicon capacitors that make up the bits in flash memory, you could basically measure the 0xAA.