Older games were smaller because they were developed from scratch without use of bloated libraries and frameworks. While these allowed faster time-to-market, the come at the cost of extra baggage. Many were also developed in assembly, making them even smaller.
4 bytes to spare, that is some precision work right there!
the royalty for a 2kB Atari 2600 game was twice that for a 4kB cartridge.
Also the developers were paid out of the sales of their own titles.