I've heard from the Talmud in Nidah and the Rambam that male masturbation is "tantamount to killing a soul." But the question is, does it have the same legal consequences as murder, like in the times of the Bayis? Would it be subject to the death penalty if there were two witnesses etc., or would someone be exiled to the cities of refuge for it, or is it slightly different?
No, goodness no. Rambam finishes Ch. 15 of Laws of High Courts and their Punishments with the complete list of sins that theoretically warrant the death penalty, and it's not on there.
Rabbi Moshe Feinstein, Igros Moshe OC4:117 (addressing "Mr. ABC"), says its punishment is less than kares, which itself is less than court-conducted capital punishment. "As for the sources calling it the greatest of all sins ... that wasn't literal."
Rabbi Yehuda Herzl Henkin has a piece in Bnei Banim explaining that any talk of excommunication is also not literal. A strong proof of that is that Kitzur Shulchan Aruch talks about repenting by trying to get more involved in synagogue life, e.g. go read the Torah, rather than less.