OS X Lion factory refresh problem
If your machine shipped with Lion (or later) preinstalled, you don't need to provide a user account and password as that serial number is used to validate ownership of the OS and the installer will re-download itself for free. This download happens from the Recovery HD and not from within the App Store.

If your machine shipped with an OS earlier than Lion (say it was shipped before Lion was released or just when Lion was released and the first user got a free upgrade to Lion), then your factory condition is before Lion. To get Lion, run 10.6.6 or later and log into the App Store app. You will need to purchase the Lion upgrade yourself or have an account that has that upgrade purchased already. 

In summary, the only software license that transfers with the hardware is the shipping versions of the OS and not the upgrades that you apply after the initial purchase.