Read it properly, they said they would sell the box, never said the money would be part of the sale. If the box costed $10, then it leaves them with $20, split between the two, is $10 profit each, whilst taking out the $40 they had put in, the buyer only buys the box for $30
Ok let's name one guy John and the other guy Harry. Both of them put in $20, which means they lose $20 each. Currently both John and Harry have $-20. John buys the box for $30, which mean he has a total of $-50, while Harry gains $30, he has a total of $10. In the box that John receive is $40, so he has a total of $-10. In the end Harry has a profit of $10 while John loses $10. The box does not really matter