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 (my website address is in my profile) Windows 10 Home, 64-bit, Version 1709, Build 16299
Here is a test to find out whether your mission in life is complete. If you’re alive, it isn’t.
~ Lauren Bacall