A £154 million deal has been struck between two US entertainments giants for the rights to JK Rowling’s Harry Potter and forthcoming Fantastic Beasts franchises.

Comcast’s NBC Universal has acquired the rights from Warner Bros in a move that could bolster ratings at its cable networks and attendance at its theme parks as the author moves up the list of highest paid writers in the world.

The seven-year deal, which begins in July 2018, will make all eight Harry Potter films and the forthcoming Fantastic Beasts movies available on NBC’s portfolio of cable networks, which include USA and Syfy.

Read more: JK Rowling to host a special screening of Fantastic Beasts

It also lets NBC’s theme parks host fan events, movie screenings and promotional activities tied to both franchises.

Edinburgh writer Rowling, 51, has climbed up the Forbes' ranking of the world's richest authors.

As her Cursed Child stage play takes over London, the legacy of her Harry Potter books, including two theme parks, has seen Rowling leap from seventh to third place, with estimated earnings of £14.2m ($19m).

Crime writer James Patterson is the highest-earning author in the world with £71.2m ($95m) tax, while Diary of a Wimpy Kid author Jeff Kinney comes in at second place with £14.6m ($19.5m).

Walt Disney’s Freeform, formerly called ABC Family, currently has the rights to the Harry Potter films.

Read more: JK Rowling has already written a sequel to Fantastic Beasts

NBC will gain the rights to show the movies in an exclusive window.

The Fantastic Beasts films will debut first on HBO and then be exclusive to NBC’s cable networks.

Although the deal between NBC Universal and Time Warner Inc’s Warner Bros has been valued at about £154m ($200m), it could increase based on the success of the Fantastic Beasts films.

The movie Fantastic Beasts and Where to Find Them, the first in a trilogy of Potter spin-offs, will debut in November and is projected to make around £154m ($200m).

NBC’s Universal recently launched the two-park attraction called the Wizarding World of Harry Potter, featuring a giant castle, magic wand shops, and a ride that simulates flying on a broomstick, as well as selling related merchandise.

Read more: JK Rowling to release four new stories that explore history of magic in US

The new attraction has lifted attendance at the park, Comcast chief financial officer Mike Cavanagh said during a recent interview.

The deal was reported by the Wall Street Journal.