Really, the union as well hung and shot deserters during the war. From Lieber code and articles of war 1806 which were applicable during the CW
Art 48
Deserters from the American Army, having entered the service of the enemy, suffer death if they fall again into the hands of the United States, whether by capture, or being delivered up to the American Army; and if a deserter from the enemy, having taken service in the Army of the United States, is captured by the enemy, and punished by them with death or otherwise, it is not a breach against the law and usages of war, requiring redress or retaliation.
Article 23. Any officer or soldier who shall be convicted of having advised or persuaded any other officer or soldier to desert the service of [page 363] the United States, shall suffer death, or such other punishment as shall be inflicted upon him by the sentence of a court martial.
Article 22. No non-commissioned officer or soldier shall enlist himself in any other regiment, troop, or company, without a regular discharge from the regiment, troop, or company, in which he last served, on the penalty of being reputed a deserter, and suffering accordingly.
Article 52. Any officer or soldier, who shall misbehave himself before the enemy, run away, or shamefully abandon any fort, post, or guard, which he or they may be commanded to defend, or speak words inducing others to do the like; or shall cast away his arms and ammunition, or who shall quit his post or colours to plunder and pillage, every such offender, being duly convicted thereof, shall suffer death, or such other punishment as shall be ordered by the sentence of a general court martial.
The Confederates likewise passed laws authorizing death as a punishment for desertion, not aware of any law Union or Confederate that actually prohibitted it. To call it a war crime, would require some actual law wouldn't it?