Mainly it was because hanging Robert E Lee and other Confederate generals would not achieve anything other than the blood hungry wishes of bitter northerners. Also, Lee had surrendered, while Brown started a revolt. One ceased violence while the other created it.
The standpoints of each (morally) are not what decided who should be hanged - it was the actual actions that were carried out with regard to legality that justified the punishments.
Why was abolitionist John Brown executed?