The Mac App Store allows you to view past purchases (Store->Purchased) linked to your Apple ID, and if you’ve upgraded the version of Mac OS in the past on any Mac, the free downloads for the OS installers are supposed to show here.  For example, when logging into the Mac App store using my Apple ID, in the purchased list I see downloads for things like OS X Mavericks, OS X Yosemite, and OS X El Capitan.

Curiously Apple decided to exclude the Sierra installer in the purchased list shortly after High Sierra came out.  I guess enough people wanting to revert from High Sierra to Sierra complained about this, because Apple has published this support article detailing how to download Sierra by clicking on a special link that opens in the Mac App Store.  This works even if the Apple ID you are logged in with has never downloaded Sierra.

On a related note, Apple also published a similar support article detailing how to download El Capitan by clicking on a special link that opens in the Mac App Store.  This also works if the Apple ID you are logged in with has never downloaded El Capitan.