If you have a 2010 or Early 2011 model Mac, and have current firmware updates applied to it, you can boot it into Internet Recovery. This would allow you to install 10.7 Lion, but only if you’d previously downloaded it from the Mac App Store.
But I’ve discovered that these older computers instead now install 10.12 Sierra, and you do not have to provide an Apple ID to do it.
Mid 2011 and later iMacs will continue to install the version of macOS that they came originally came with when using Internet Recovery. Only the 2010 and Early 2011 models have made this change.
Here’s all the gory details, if you are interested:
Mac OS X 10.7 “Lion” was released on July 20, 2011, so Macs released before that came with 10.6 “Snow Leopard”.
One of the new features of Lion was the Recovery Disk, which allowed you to reinstall the operating system, among other things; with this, Apple stopped including a DVD or USB stick in the box that contained the operating system.
And one of the new features of Macs that came with Lion was Internet Recovery. Even if you had a completely empty drive without a Recovery Disk on it, you could still boot the computer into a Recovery Disk directly over the internet, and get a functioning system up and running from nothing. Pretty spiff. Internet Recovery would load the same version of the operating system that originally came with the computer, regardless of if it had been upgraded at any point, and without any Apple ID authentication.
Apple also added the capability, via firmware updates, to boot into Internet Recovery even for some computers that predated Lion: All 2010 models and Early 2011 models. Normally, this would be done via the usual software update process. (If you want to make sure your firmware is current, you may do so at this link: About EFI and SMC firmware updates for Intel-based Mac computers)
On these models, if you use Internet Recovery, you’d get the Lion installer, rather than Snow Leopard. However, when you use Recovery Disk for an operating system that is newer than what came on the computer, the expectation is that you got originally got that newer OS from the Mac App Store; even though it’s free, it counts as a “purchase.” Therefore, when you install the OS, it asks you for an Apple ID that had previously downloaded the newer OS, and if you don’t have one, you can’t install it.
So on 2010 and Early 2011 Macs, you would get asked for your Apple ID when you try to reinstall Lion that way. If you’d downloaded Lion before, great. If not, you’d have to come up with another option, like creating an install disk using another computer, or buying Lion (it became no longer free once it was succeeded by Mountain Lion).
But Sierra no longer behaves as a Mac App Store “purchase,” so it no longer needs to be verified when you install it. I’m guessing Apple saw this as a way of simplifying things for these older Macs which can’t have their original OS (Snow Leopard) installed; it guarantees that someone who’s never even touched a Mac before could take a completely empty machine and get it up and running.