It is entirely arbitrary. An agreement can be made in advance, but usually a ticket given as a gift, the winnings then become the gift. The winner might share out of the goodness of their heart. In a recent legal case, a worker took tickets purchased by the group, plus bought one for herself. When one ticket won big, she tried to claim it was the one she bought personally, but a judge didn’t agree. He ruled the winnings must be shared.