|Have your cake and deduct it too.|
Answer: Yes, over time. You get a little deduction every time you sell a book. At first, your costs are inventory.
For example, you publish 1,000 books and you pay $4,000 for the privilege. You don't deduct the $4,000 yet, you have an asset, $4,000 worth of inventory (1,000 books that cost you $4.00 each). When you sell, say, 800 of the books for $7.00 each, you have $5,600 in taxable revenue (800 x 7). You also have a Cost of Goods Sold deduction of $3,200 (800 x 4). So your taxable net is $2,400 (5,600 - 3,200).