Known as a "sponsored story", the ads popped up on a user's friends' pages after the user clicked to "like" a firm's advert.
The deal with users who sued was reached in May, but court documents were made public this weekend.
The Facebook users filed their lawsuit in December 2011 in a federal court in San Jose, California, claiming that the social network had violated the state law by making their "likes" known to others without allowing them to opt out or paying them.
But the judge ruled in favour of the plaintiffs.
"California has long recognised a right to protect one's name and likeness against appropriation by others for their advantage," Judge Lucy Koh wrote, reported Reuters.
The social network said the settlement funds would go to charity.
It is just another court case involving the social networking giant, which listed on the Nasdaq stock exchange in May.
One of the most recent cases involves Mr Zuckerberg and the banks leading the firm's flotation being sued by shareholders who allege that the site's revised growth figures were not disclosed to all investors.