There are a few challenges around offering unique download codes for books:
1) the code would have to be obscured (think shrink warped book or scratch covering) to ensure that people didn't walk out of the bookstore with a library of free eBook downloads.
2) books (especially bestsellers) tend to be printed using an offset press. Offset printing means that every copy is identical, so printing something unique in each book increases the complexity (and cost) of production.
Neither of these are impossible to overcome, especially as many mass market paperbacks are now printed using digital Print on Demand (POD) production rather than offset production. Although POD quality is lower and costs are higher (the advantage comes from just in time production rather than printing and warehousing).