EDIT: The accepted answer below works, but I can also confirm that just booting the stock machine and visiting the App Store, you can just re-download it and make a boot USB drive before swapping out the hard drive.
I just bought a new i7 Mac Mini and will be upgrading the hardware to a 256GB SSD and 16GB RAM.
OSX Lion comes pre-installed on the stock 1TB hard drive. When I swap out the drive with my new SSD, I'll obviously have to install Lion onto it. If I boot my Mac Mini with my stock drive and visit the App Store to download Lion, will I have to pay for it, or will it assume I've already paid since it's installed, and allow me to re-download it so that I can make a bootable USB?
Best Answer
Macs introduced after 10.7 was released (and mid-2010 to mid-2011 Macs with a firmware update) support internet recovery: if you start up with a new hard drive, you are shown a gray screen like this and something like the contents of the recovery partition are downloaded over the internet:
http://support.apple.com/kb/HT4718
You can then install the OS your Mac came with for free or restore the old installation from a Time Machine backup.