A relevant book on this important (and evolving) topic is 

Math You Can't Use: Patents, Copyright, and Software
by Ben Klemens (2006)

