“To cut (or split) a melon” is a delightful procedure, both for the cutter and for him who receives a portion of the melon.
He, or more likely they, in charge of the cutting is delighted that there is something to cut, and the receiver always has had a mouth watering for the taste.
In other words, this was originally Wall Street jargon meaning to distribute dividends, especially extra dividends, to the stockholders of an enterprise.
As such, the term came into use about 1906.
Nowadays we also use it to mean to distribute profits of any kind to any entitled to receive them, usually the heads or principal officers of an organization, the employees, the financial backers, etc.