It's because Jaime swore an oath to protect the life of his king, not just the king's peace, at all costs, including the cost of his own life. Ned made no such oath, and I think only the heads of the house have to pledge fealty to the king, so Ned had no oath to keep with Aerys, since at the time he wasn't in line to become Lord of winterfell.
That's why (publicly at least, more likely he just wanted to kill Robb if he took him up on the offer) Joffrey wanted Robb to pledge fealty to him, to end the war by making Robb recognize him as King.
Also, it's even hinted at through Jaime's viewpoint chapters, that he didn't kill Aerys for entirely honorable reasons. His family had a lot to gain from the death of Aerys and putting Robert on the throne. He even talks about half of what he does is for the benefit of Cersei, at least in the beginning.
Spoiler Cersei was spurned by Aerys when Tywin made the offer for her to marry Rhaegar, who ended up with Oberyn Martell's sister. Aerys also purposefully diminished the Lannister's power by accepting Jaime as a Kingsgaurd, thereby making him unable to inherit Casterly Rock and the western Lands from Tywin.
Helping his family gain more power within the seven kingdoms was a bigger motivation for Jaime to kill Aerys than a sense of honor in killing a mad man.