The scenario you propose worked perfectly for me in the past, but that was still in the Windows XP days.
As you have been told, this may or may not work now, particularly if you're using Windows 10. Presuming both machines were legally licensed for Windows 10, I am uncertain what would happen were machine 2 to get machine 1's hard drive and the license then be checked by Microsoft. It could be that if machine 2 has been licensed for Windows 10 that the license might simply be written to the hard drive and you go on your merry way or, conversely, you might be told that the Windows 10 OS on that drive is not legally licensed for that machine and stopped dead. It might be something "in between" those extremes.
Since this is a simple thing to test if you've got the hardware available I'd just give it a shot. Then please report back the details of what happened and include the hardware and exact version of the OS. You are the "trial balloon".
Brian AKA Bri the Tech Guy (website in my user profile) - Windows 10 Home, 64-Bit, Version 1809, Build 17763
Presenting the willfully ignorant with facts is the very definition of casting pearls before swine.
~ Brian Vogel