With some of my clients, I negotiate dual-ownership of the end software in exchange for a lower price. That way, if it is something that looks like it could be monetized as a product, I have the ability to do that.
Our standard practice is that all software we build for clients is published as Open Source. This leaves things like templates and configuration out, of course, but still every project grows and improves our toolkit.