Why was Egypt's legal system so harsh?

I would guess because of the climate. The desert is inhospitiple, and can be cultivated only with coordinated mass social effort. These sort of tasks, and the great projects, the pyramids, the planting of the nile, the dam in modern times require unification. In comparison, the ancient Greeks had many ways to make a living, so they have many options for lifestyle and dissent, the ancient Egyptians on the other hand all depend on the Nile for survival, so they must entrust their lives to one unilateral force that can get the job done (the pharo or administration), and deviance from this plan, or social unrest endangers lives much more significantly than in a country where there are a variety of places to live and a variety of modes of production