Enchanting for example a diamond pickaxe in survival mode on level 30 doesn't remove 30 levels, it removes 3 levels. Enchanting a diamond pickaxe on level 13 removes 2 levels since 2 lapis is used.
How to reproduce:
Create a new world
setup an enchanting table with its max bookshelves
use xp bottles to get level 30
enchant a diamond pickaxe with 3 lapis on level 30
-> you're level 27 instead of 0, the lapis is gone and you got the pickaxe
What I expected:
It should take away 30 levels instead of 3
This is planned and was there since 1.8