In tax law, gain isn't the difference between value received and value given up. It's the difference between value received and the cost of what's given up. If your three chickens cost you $20 but the pig is worth $30, you have $10 of gain. Since you paid nothing for your labor, all of what you receive for working is gain.
Some will argue that food, shelter, clothing, etc. are required in order to work, so there is a cost in one's labor. The short answer is that these expenses would have to be incurred even if one didn't work. The legal answer is that the law views compensation for work different from gain from dealings in property. The former is included in income under Section 61(a)(1) of the Internal Revenue Code, while the latter is included under Section 61(a)(3).