This was an on-foot mission. It's a bit hard to scan someone while they are shooting at you so no, I did not scan them. I hardly ever scan on-foot targets. I suppose I got the bounty because this person was out in the wilderness instead of at their (usually anarchy) settlement.
Still: I'm scanning for a bounty right? And I was there because they had a bounty. A passive scan gave me their name. It's a bit ridiculous to have to scan them again!
Scanning them doesn't help, that's just misinformation. Even if they were a criminal target when you took the mission, once they flee, they become a normal NPC with no bounty and when you kill them...
At no point in EDO that I know of do you need to scan any target to kill them to avoid a bounty. You either avoid a bounty because the location allows it (anarchy settlement) or you do not.
I'm assuming you took the mission because it wasn't a purple "illegal" (the meaning of which is pretty flexible in EDO) take down. My experience with this mission type is you can usually rely on this to be true for assassinations (with a caveat I'll cover later, but I think you already worked this one out). If the target is a criminal organisation, then you can visit their settlement and do whatever you like without getting any bounty.
The caveat to that is when the target flees. The body they flee to may not be owned by an anarchy faction (it usually isn't) and so when you kill that pirate, you will get a bounty. I think you have already realised this and I think this is the reason you got the bounty. It is, for me, one of the more annoying parts of EDO missions. I don't take these unless I really need the materials rewarded for them. The odds of it turning illegal are too high. I think that they should remain a legal kill
irrespective of where they go. And the reason for that is they should have a bounty (this being a mission to kill a criminal). I think it's an oversight FD never got around to fixing, personally. In no way doing these missions in a ship can you ever get a bounty for executing the mission, regardless of the location you kill them. I think FD added this "wrinkle" to this mission type and just neglected to even notice that it could result in this happening, because it's just not consistent with the rest of the game (nor is it particularly good for game play in my opinion)>
As I said, legality and EDO missions is a straight-up minefield.