because occupation is one civic, and viceroyalty is another civic. 2 Different civics that act differently...
in details:
the bonus of Occupation is that while you run it, you get a +2 permanent stability bonus for every occupied city. This bonus goes away when you switch away from this civic, IE you won't get a +2 stability for the next city you occupy.
the bonus of Viceroyalty is that while you run it, you get a +4 temporary stability bonus for every vassal.
If you read the wiki about stability, then you should know that stability modifiers are of 2 kinds: permanent, and not permanent.