We can't get taxed for giving away code. Assuming the foundation actually owns copyright to any code (right now, RedHat and a slew of individuals and universities like MIT own the copyright to various bits of OpenACS so it's a non-issue).
We can't get taxed for accepting grants that are only open to non-profits.
We can get taxed if our 501(3)(c) were to compete with consulting firms, etc, but of course we're not going to do that. We might contract with for-profit firms like Collaboraid if we win grants but then that company, of course, is a tax-paying entity. Non-profits contract with for-profit companies all the time, i.e. lease space, pay for legal and accounting help, etc.
And there's a whole slew of open source non-profits out there that aren't getting attacked by the IRS.
I sat on the board of a reasonably sized ($2M/yr budget) non-profit for 15 years, and have been involved with others, and am fairly knowledgable about them. I see absolutely no risk of the sort Torben's outlining.