There’s always a lag between when Apple releases a new version of Mac OS X and when Macs start shipping with it. To address that, Apple has long made free updates available to those who buy a Mac after a certain date, and this is once again true of OS X 10.8 Mountain Lion, via the OS X Mountain Lion Up-to-Date Program.
If you purchased a new Mac between 11 June 2012 and 25 July 2012, you must enter your purchase details by 24 August 2012 to claim your free upgrade to Mountain Lion, normally $19.99. Apple has a separate link on the Up-to-Date Program page for those who buy a Mac that doesn’t come with Mountain Lion on or after 26 July 2012. In this second case, you must apply within 30 days of your purchase.
The Up-to-Date Program also applies to the recent purchase of any Mac server that ships with Mac OS X 10.7 Lion Server — you can apply to get both a free copy of Mountain Lion and a free copy of OS X Server, which is normally a $19.99 add-on from the Mac App Store. Scroll down on the Up-to-Date Program page to find the OS X Server offer.
Discussion on TidBITS Talk suggests that Apple will send email containing the necessary codes to redeem in the Mac App Store, but that it may take up to 72 hours for them to arrive.