This is an old post , but still in discussion in today's world.
In my opinion, if you are paid by the hour and guided by the client to build a software program, you should hand over the source code.
If you have commercial software and you sell it to them to use.. then no you should NOT hand over the source code.
Regardless of what is legal or not ....as I am not a lawyer either. The right thing to do is hand over the source code. What if somethings happens to you? Your client is left out the cold. In addition, what if your software causes the company harm? YOU ARE RESPONSIBLE! Let go of holding code in hopes to be paid for future work. Just do a good job at a reasonable price in the first place and the work will continue.
And to the person who charges 5X for source code. As a programmer I'd assume you're very good with math. Why would anyone pay 5X for something .. when they can pay another person 1x to just replicate what you built? This is a fast way to get fired. You can't eat your source code... so with thinking like this.. you and your source code will be sitting on the sidelines.