Yes, they sell data. To see how this works, start an ad campaign targeted at people who love X. People who click the ad will be directed to you. If they buy stuff from you, you have their info, and you can directly target them for more X, or sell the fact that these people like X to other companies.
Some people think that Facebook, or any advertiser, that allows you to target ads using data they’ve collected but can’t access directly counts as selling it, others don’t. The former seems to be in the minority outside of HN.
Good thing I don't rely on HN comments for facts.