I'm not sure where it originates from, but I have heard it claimed that Marx and Engels said that distribution under socialism was to be "from each according to his ability, to each according to his work."
If I recall correctly, the phrase is Stalinist in origin and may even have been included in the 1936 Constitution. Trotsky criticized it most severely, arguing that making livelihood dependent on some measure of "work" is the essence of the unfreedom that makes contribution according to "ability" impossible as a universal rule until the abundance characteristic of the "higher stage of communism" had been achieved.
Shane Mage
"Thunderbolt steers all things."
Herakleitos of Ephesos, fr. 64