Not to be a jerk or anything, but half of this post is incorrect. don't has only ever had the film rights. Those where sold off by marvel back during their bad business and bankruptcy days(along with blade and DD, and FF and xmen ect and not all to Sony I get that). Everything else that was done was under a licensing agreement. Disney owns marvel. They never needed to buy anything back from Sony. And marvel never sold any cartoon or merchandising rights to anything.
The only reason film rights where sold was because marvel did not have or own it's own studio and never expected to. DC still doesn't. No one thought it would ever work. But they did have at different points an in house cartoon division. And when it went out of house, it was just a licensed product. They never sold the rights.
Technically never sold the film rights either. Sony doesn't own the film rights. They have a lifetime lease, so long as they release a movie every so many years. And even then Marvel gets a cut. And marvel has rights to merchandising for the films. But Sony gets a cut. Sony can't sell the rights or lease them to anyone else. They are not considered an asset, so if what happened to MGM happens to Sony the court can't sell Spider-Man's film rights to help make Sony solvent. They could agree to relinquish any future claims on film rights so they revert back to Marvel for a fee. (Or for free if they wanted). They could also come to just about any understanding they wanted with marvel. It's marvels property so marvel could do whatever.
It's complicated, but Sony didn't own merchandising or cartoons, they just have an auto renew lease (if a new movie is released theatrically in the USA every set number of years) on the film rights, and they get a cut of the profit on film related merchandising.