Why is Necromancy legal in Tamriel?
The best source on this is probably the book The Black Arts on Trial, which can be found in Oblivion and Skyrim, although some useful information can be found in other books on necromancy (a full list is at UESP:Lore:Necromancy). Unfortunately, while these contain information on the historic status of and attitudes towards necromancy, none of them explicitly explain why it is not banned by the state.
What we do know is that Necromancy, while not banned by force of law, has always been forbidden by the Mages' Guild (and its predecessor the Psijic Order) -- it is not taught and independent studies of it are discouraged at best. The degree to which this has been enforced, however -- and to what degree they have tried to impose this ban on independent mages not part of the Guild -- has varied depending on the personal attitudes of the Guild leadership over the years. Archmagister Traven's ban on it in Oblivion is not a new policy, but increased enforcement of an ages-old one that some of his predecessors turned a blind eye to violations of.
The same book notes that the dividing line between Necromancy and some other schools of magic like Conjuration and Mysticism is very thin and somewhat arbitrary (as the schools themselves are). It also mentions that while Necromancy is not well liked by the populace at large, few people have a good understanding of what it is or how it is distinguished from other schools of magic.
-- Everything below this point is speculation. --
My suspicion would be that the lack of an official ruling on this matter is down to two things. The first is that with the precise definition of necromancy so hard to pin down, drafting a law to forbid it is difficult; it is easier to ignore necromancers who aren't making a nuisance of themselves, and deal with necromancers who are under existing laws forbidding things like grave-robbing and murder. The second is that, with the ban against necromancy largely originating from (and enforced by) the Mages' Guild, there is little need for a legal ruling on it when the Mages are the only ones fully equipped to understand what is and is not necromancy, even given a regime hostile to necromantic practices. You don't want a healer getting arrested because some overzealous guards think that any magic involving blood is necromantic, nor Lich-King Souleater Skullfire walking free because he can plausibly argue that the army of skeletons is conjuration rather than necromancy; far better to just report such things to the Guild and let them investigate.