The MAC address is stored in a dedicated place in NVM section managed by BLE stack.
You can use private, public or static random address. The static random address is generated and programmed at first boot of the device on the dedicated Flash are and never erased (except if you perform mass erase)