Deut 25:5 When brethren dwell together, and one of them dieth without children, the wife of the deceased shall not marry to another: but his brother shall take her, and raise up seed for his brother:6 And the first son he shall have of her he shall call by his name, that his name be not abolished out of Israel.
7 But if he will not take his brother's wife, who by law belongeth to him, the woman shall go to the gate of the city, and call upon the ancients, and say: My husband's brother refuseth to raise up his brother's name in Israel: and will not take me to wife.
8 And they shall cause him to be sent for forthwith, and shall ask him. If he answer: I will not take her to wife:
9 The woman shall come to him before the ancients, and shall take off his shoe from his foot, and spit in his face, and say: So shall it be done to the man that will not build up his brother's house:
10 And his name shall be called in Israel, the house of the unshod.
Death was not the punishment for simply violating the levirate law. Also, if that was his offense, there would be no need for the Bible to explain what method he used to get around it.
True, although later on that story, when the father-in-law has sex with that same woman, he gets her pregnant, which is a form of incest. Yet, he is not struck dead. The woman also lives, although in theory she should die as she did these things knowingly. Strange story.