A hayloft is used for more permanent storage of hay. It is sheltered from the weather and where a modern-day attic would be.
A hayloft serves as a long-term storage space for hay, much like a modern attic is used for storing items in a home.