They were things I needed to develop for other projects I was working on (some for profit, others not). I found them very useful and thought others would, too -- so I released them.
Could I have sold them? Probably. But I was already paid for these because I used them in projects that I did sell, and I prefer to release useful software to the community when I can afford to. It's better for everyone that way.
Also, there's the question of support. If I sold them, I'd be obligated to support them. That's an additional cost that I didn't want to commit to.
Some libraries that provide an interface to a commercial system will be given away free by the company to make it easier to get people using the system. Once they're using it they can then be converted into a regular income.