Your implication is that Facebook themselves sold this data. The orignial article says that it was from apps that people isntalled from a 3rd party, not Facebook.
[1] I'm using "pay" loosely here. I have no idea what they had to give up or produce in order to get the data, but presumably FB received something of value.
[1] Not necessarily a good indication, as this may be a last ditch effort convert _some_ value out of their app development efforts, and who knows to how many buyers the seller has sold this data.
No, it doesn't cost anything to create a Facebook app.