Batman is an illegal vigilante, who is in fact a private citizen and not a commissioned officer in the armed services. Killing he does would not be sanctioned the way he keeps things between him and Gordon.
Cap is a commissioned officer, a government agent. He's fully legitimized to kill by the government, if he thinks it has to come to that.
But, if Batman where in a situation where it was his life (or the life of an innocent) or the life of The Joker he would be legally justified in killing The Joker. If someone breaks into my home and I feel my life is threatened I'd be justified in killing the intruder (up until the point he flees.)
How many times has Batman been in a situation where The Joker was threatening the life of an innocent Gothinian (or whatever) and instead of taking the Joker out Batman simply does something to knock The Joker out or cause a distraction to allow him to save the innocent person? Now, sure, the innocent person may have survived so all is good but more often than not The Joker -sooner or later- will be back out there causing crime and the next innocent person to be in The Joker's hands might not be so lucky.
Batman killing The Joker in a situation where The Joker's threatening life or property would be a justifiable homicide. I'm not a police officer, or a soldier but if I kill a man who is threatening lives then little action would be taken against me, at least legally; civilly is another matter.
I argue that Batman would be justified if he killed The Joker (in certain circumstances, Batman can't just go up to The Joker and kill him anytime he wants) and it could probably be argued that Gordon's treatment of Batman suggests that Batman is, at last informally, is "deputized" to act as law enforcement in some capacity.