The EZ-Flash IV stores save data in SRAM, a type of memory that requires power to keep the data stored.
While the GBA is powered on the console provides power to the SRAM. When you turn the system off, the battery in the EZ-Flash keeps the SRAM powered until you turn the system back on.
The EZ-Flash only writes the save file from it's SRAM to the miniSD card when it's menu loads (either after you turn the system off and back on again, or soft reset back to the menu).
If the battery in the cart was to ever go completely flat, you can still get the save data written back to the MiniSD card either by soft resetting or very quickly turning the GBA off and back on again.
The battery in the cart is not used to power either the NOR flash, or the RAM that stores the games if you run them normally (not from NOR), so where you run the game from has no effect on the cart's battery.
NOR is a form of flash memory so it keeps its data without power, no need for battery backup. The upside is it stays there without power, the downside is that it is slow to write to.
Running a game normally on the EZ-Flash writes the game to RAM that is not battery backed up, which is why it has to be re-written each time you power on the system. The upside is its much much faster to write to.