But it's not "from each according to his ability". FOSS is what people feel like contributing. And it's not "to each according to their need". It's take it or leave it, unless someone feels like fulfilling requests.
Traditionally, the slogan meant a duty to work. Contributing what you feel like is just charity.
Capitalism, at its core, is private control of the capital. Copyright law turns code into intellectual property/capital. I've read the argument that copyleft requires strong copyrights. That argument implicitly makes copyleft a feature of capitalism. You know how rich people or corporations sometimes donate large sums to get their name on something, EG a hospital wing? That's not so different from a FOSS license that requires attribution.