The producing open-source software book has a great section on dual licensing. It outlines the approach where a single entity, such as a foundation "owns" the copyright to a projects source.
The foundation chooses to make the source available under two different licensing schemes, one closed and another that is open-source. For your particular case you will want to ensure that you stick with a strong copyleft license (i.e. such as GPL) to prevent commercial derivative works of the freely available source code.
However, as others have noted, this does not prevent commercial entities from using your software, just from taking your work and selling it to others. In some cases this works out, as strangely enough, many organisations would rather purchase something than download and use something for free. These are the same sorts of organisations that need legally binding contracts with vendors and some form of support. I.e. When you sell software you are actually selling a whole bunch of other services at the same time as a "shrink wrapped" product.
Now, how can code be kept closed and sold, as well as released under the GPL license? The mind bending legal part of the whole arrangement, is that contributions of IP to the foundation are not made under the GPL license. Rather, developers give their IP to the foundation under "contributor agreements" which pass on copyright of their changes to the foundation and permit the foundation to release the code under two different licenses. This last little caveat is the big downside to dual licensing, sometimes developers are not interested in contributor agreements, they want there changes only available under the open-source license and nothing else. Quite a few contributor agreements that kick around the place, but here is the one that sun uses for MySQL.