Printing, warehousing, distribution, handling remainders, the privilege of having your book on O'Reilly's market website, coordinating distribution of updates to ebooks, etc. are not one-time efforts. All of this invisible stuff eats out of your percentage and out of O'Reilly's. In fact in traditional publishing schemes books rarely make a profit. Publishing is a hits-based industry even though the publisher appears to take so much from the author, precisely because everyone glosses over the long-term invisible costs.