Apples are a great at storage. Some can be extremely hardy if kept in a mostly dry and cold place. It was one reason they became so popular: you could keep them over winter in a root cellar.
This is how we get out-of-season apples. They basically get stored in refrigerated warehouses.
Granted not all apples are like this. Some become mealy pretty quickly.