This sounds like a very viable option, especially if you make it easy for someone to expense the copy of the book. I don't see how adding an option can really annoy the existing readers too much; perhaps you could make it MIT licensed for purchasers?
You may also want to consider the legacy - many wonderful texts and code has been lost to time because the author passed on and the heirs didn't bother continuing to maintain/make it available, and without being able to contact someone, nothing can be done. Perhaps an "abandonware clause" that X years after publication the code can be considered BSD licensed?
You may also want to consider the legacy - many wonderful texts and code has been lost to time because the author passed on and the heirs didn't bother continuing to maintain/make it available, and without being able to contact someone, nothing can be done. Perhaps an "abandonware clause" that X years after publication the code can be considered BSD licensed?