This article discusses how it works. Here is how to opt out of this (from the article):
All you have to do to prevent this is sign in to Facebook and click through to (get ready) -> Settings -> Privacy -> News Feed and Wall -> Facebook Ads -> Appearance in Facebook Ads and click "no one." Unless, of course, you want to be semifamous and have your picture used to push some garbage product or website without your knowledge. (note: when I tried to make this change just now, the site returned an error. oh, and it might not work in Firefox either due to a 'bug.')"
Note the Firefox problem above, so you may have to do this in Internet Explorer or another browser.