It's illegal because we have yet to change the laws made in a fundamentalist time into something a little more sensible. Like with gay marriage.
As long as all parties are consenting and have a contractual framework that explains who gets what if whom does something, then there is no logical reason to prevent it.
In that same vein, if "marriage" is to be recognized differently than other types of contracts (like it is right now), then pre-nuptual agreements should be mandatory for ALL marriages, no matter the number of adults involved. That is, for two-person marriages, all parties must be consenting and have a contractual agreement that states who gets what in the event of death or divorce.
Not all multi-person marriages are the same, either. Some may be Person 1 is married to Person 2 and Person 3, while others may be Persons 1, 2, and 3 are all married to each other.
As a final note, gender has nothing to do with this at all and has no place in a civilized society.