1. If a target is wanted by its own faction, there is no reputation lost on the kill. So, for example, if I kill an Empire-aligned ship that is wanted in Empire space, I don't lose reputation.
2. If, however, a target is NOT wanted by its own faction, there is reputation loss. So when I kill members of an independent pirate faction within Empire space, the pirate faction fairly quickly hates me for it.
I think the problem is that
a) There are far too many "independent" factions that are not simple pirates and suffer from that issue - corporations, political parties etc. They operate inside an Empire system, but somehow they are deemed independent of the Empire (why does the Empire allow that even?) and thus you suffer from weeding out the bad apples amongst them.
b) In systems that are independent as a whole, the various factions are not affiliated with the one controlling the system, ever, i.e. not a sort of "mini-Empire" with subfactions to which #1 would apply. So everyone is independent and thus you lose rep with everyone but the one faction controlling the system.
It doesn't help that outside of RES, there are so many pirates and gangsters that belong to totally legit corporations. Like, do they all employ thousands of thugs to rob traders? It's especially strange to see a pirate attack a trader from their own faction - and if you help the trader you LOSE reputation with their faction...
I now call that effect where you are punished for taking out a pirate the
"magical reputation armour".
I'd love to see it changed into a system where if a faction is doing legal business, it behaves, reputation-wise, identical as if it had issued any bounties themselves. Pirates, of course, should always hate you for taking out their gang members.