The logic behind this is the following. When you get an item with recycle, no matter where you get it from, the item stays with you after the battle. This is so because the general use case of recycle is getting back a berry you've eaten in battle, and it wouldn't make sense to lose it after the battle ends. However, recycle can recover any item lost in battle by the pokemon. Also items lost by using fling. So, if a pokemon steals an item with covet, fling, magician... and then loses it, it will be considered a lost item for recycle, and so it will be possible to recover it. When the item is recovered using recycle, it will become permanent and not dissapear at the end of the battle because that's how recycle works.