Is this the command I would use to give the villager the trade and the tag? /data modify entity @e[type=minecraft:villager,tag=!AlreadyHasTrade,limit=1,sort=nearest] Offers.Recipes append value {maxUses:99999,buy:{id:"minecraft:diamond",Count:1b},sell:{id:"minecraft:emerald",Count:2b},Tags:["AlreadyHasTrade"]}
EDIT: I realized I could just run /data modify entity @e[type=minecraft:villager,tag=!AlreadyHasTrade,limit=1,sort=nearest] Offers.Recipes append value {maxUses:99999,buy:{id:"minecraft:diamond",Count:1b},sell:{id:"minecraft:emerald",Count:2b}}, then run /tag @e[type=villager,tag=!AlreadyHasTrade,limit=1,sort=nearest] add AlreadyHasTrade at the location if the first command passed.