Law firms and investment banking firms share a common quandary, especially when a merger is in the cards: Their most prized assets — rainmakers — are also their most mercurial, walking out the door at the end of each day.

Creative structuring to keep talent on board proved to be what wheedled the deal for the $104 million acquisition of Florham Park, N.J.’s Ryan Beck & Co., announced Tuesday.