Batman is not the judicial system though, he can't predict what will actually happen to him. Joker killed MANY cops. The death penalty would certainly be on the table if it was legal in Gotham. He could have also potentially been tried as a federal criminal. The prosecution would be trying to prove that he was fully cognizant of his actions at every turn, and it took the mind of a criminal genius to plot out what he did. Oh sure, Joker would plead insanity but if you're looking at it realistically, it would be a very long trial with a lot of questions in the air.