Anvils will not reject a enchanted book if an item has the same enchantment but on a higher level.
- Go into creative mode and get a diamond axe, an efficiency 5 book, and a efficiency 3 book
- Add the efficiency 5 book to the axe
- Give yourself at least 30 levels of xp
- Go into survival mode
- Add the efficiency 3 book to the axe
→ Notice how the anvil doesn't reject it