You have missed an important part: at the time of sale Porto owns 95 or 100% of the players.
Example: Hulk. Bought from Japan 5.5M for 50%. 2 years later the club bought the remaining 50% for 8M. That deal was done at the time of the purchase. And then he was sold for 55.
Same goes for James...