This can be replicated by using these commands in a function pack or a command block chain being run every tick
Commands being used:
execute at @e[type=item,nbt=<insert corresponding nbt>] run give @p <item><nbt>
kill @e[type=item,nbt=<same as above>]
then drop the item
this used to give you back the item in 1.13, but in 1.13.1, the item disappears yet can still be dropped, thus creating a ghost item.
Cannot reproduce in 1.17.1.