Splitting the pot without showing hands
This is a form of collusion, and would not be permitted in many casinos or tournaments according to their rules.

A home-game or less-reputable operation may make its own rules that allow this, but it would be considered very dodgy.

Legality does not typically factor, though anywhere in which it matters, either the entire game is illegal anyway or the operation already has rules to ensure they comply with law and regulation.