Investment banks reported more than $ 320 million from the sale of AT & T’s WarnerMedia to Discovery, just five years after many of those same advisers paid hefty fees when the media group sold the company to the American telecommunications company.

AT&T agreed to separate and merge WarnerMedia with rival Discovery earlier this year at a significantly lower price than it paid to acquire the entertainment group in 2016.

New York-based boutique bank Allen & Co received $ 75 million for its services to Discovery while JPMorgan’s bankers earned $ 15 million for advisory work and an additional $ 140 million for financing services, according to Discovery’s proxy statement.

Advisors for WarnerMedia included Goldman Sachs, which received $ 47.8 million, and investment bank LionTree, which earned $ 43.1 million, according to Refinitiv estimates.

Five years earlier, bankers, including those of Allen & Co and JPMorgan, made $ 234 million after AT&T agreed to buy WarnerMedia – then called TimeWarner – for $ 85 billion, according to Refinitiv.

Allen & Co, a low-advertising group that doesn’t have a website, received $ 50 million for advising WarnerMedia on the AT&T sale, while Citigroup and Morgan Stanley raised $ 50 million and $ 40 million, respectively. JPMorgan, Perella Weinberg Partners and Bank of America each earned $ 31.2 million in advisory services to AT&T.

AT&T senior executives have received a $ 9 million bonus for the acquisition that has not yet been chosen.

Wall Street banks have enjoyed record commission income of over $ 100 billion this year from merger and acquisition advice thanks to a transaction boom, which topped the $ 5 billion mark for the first time .

Making deals with the media has been a major driver of the boom as companies rush to compete with streaming services like Netflix. Earlier this year, Amazon bought MGM, the movie studio behind James Bond, for $ 8.5 billion.

AT & T’s deal with Discovery, which creates a company with an enterprise value of $ 132 billion, highlights the speed at which mainstream media groups are rushing to compete in the streaming war. The fees generated by investment banks underscore the lucrative rewards offered for setting up and separating transactions for clients.

The deal, led by AT&T chief John Stankey and Discovery’s David Zaslav, will combine Discovery’s catalogs, which range from nature to history, with prized media assets including Warner Bros. Studios, the HBO network behind television series. Succession, and cable TV channels, including CNN.

JPMorgan, Goldman Sachs and LionTree declined to comment. Allen & Co does not have media contact details.