Tim O'Reilly's short answer on his Web site is this:
You can use and redistribute example code from our books for any non-commercial purpose (and most commercial purposes) as long as you acknowledge their source and authorship. The source of the code should be noted in any documentation as well as in the program code itself (as a comment).
He then goes into a bit more detail. The bottom line is that using the code as part of a larger project is generally OK so long as proper credit is given. Competitive uses-for example, publishing a CD with the code snippets or including them in another book are not. It's got some elements of the original BSD license (with advertising clause) with the important caveat that O'Reilly will frown upon uses that directly undercut the market value of its own (or the author's) products or services.
O'Reilly's position seems quite commonsensical. It also somewhat codifies what's long been common practice. My personal interest is that I once developed and sold a DOS file manager, Directory Freedom, which (to quote the docs):
originally grew out of a variety of programs which owe their "look and feel" to Michael Mefford's DR and CO utilities in PC Magazine Volume 6, #17 and #21. DF was most directly adapted from Peter Esherick's DC (Directory Control) version1.05B. Peter helped get DF started by making the source code for DC available to me and has also shared some fixes which he has made in subsequent revisions of his program.
This type of reuse and adaptation was fairly common on a small scale in the days before today's Open Source hit in a big way. (I'm talking roughly the mid-eighties to mid-nineties here.) Code in magazines like PC Magazine, Dr. Dobbs, and PC Techniques was certainly copyrighted, but it basically existed to sell the magazines, as opposed to being commercial software in its own right. In practice, it was generally assumed by just about everyone that most uses of the code were proper, even if good manners suggested giving credit where credit is due.
One interesting aspect is that this code, while not licensed as Open Source, can in practice be used more flexibly than true Open Source licensed under a "viral" license like the GPL which requires that derivative works be likelwise licensed under the GPL. In fact, my Directory Freedom could not have been a shareware product had the PC Magazine utilities been explicitly under the GPL rather than the implicit loosey-goosey de facto BSDish terms under which they were actually published and used.