Back in the good old days, games were delivered on cartridges, which were much more expensive to manufacture than today’s DVD and Blu-ray discs. A game cartridge needed a bunch of chips and memory units to hold a game. In some cases, a battery was fitted so that save games wouldn’t be lost when the cartridge wasn’t in the console.
As the photo below shows, the NES cartridge actually includes a battery, while the newer Nintendo 64 counterpart stores save games directly on to non-volatile memory. However, as the second image shows, some N64 cartridges did include a battery, such as Zelda Ocarina of Time, which was one of the most complex game cartridges ever made. You could actually feel it was heavier than other N64 games.
The inside of a Zelda: Ocarina of Time N64 cartridge