How to reproduce the issue:
player must be in creative mode.
open a custom anvil inventory, and listen to InventoryClickEvent, cancel clicks that happens on slot 3(result slot)
place any item into left slot, and rename the item, click on result, you will be able to pick up the item, then place it into your inventory, and press E to close the InventoryView.
player will have the item renamed without experience cost, also the old item will still exist in the anvil inventory, result in the item being duplicated.
Extra information:
this only happens when player is in creative mode, if in other mode, when clicked on the renamed item in your inventory the item will return to the left slot and original name.
The experience will show as deducted, but experience change, it will go back to original.
I'm not sure if this will happen with normal Anvil.