There are two repositories at work here. Firstly the main ones, next the update repos. If the package in the update repository is newer than the one in the main repo then during a system update it is downloaded and replaces the original.
On the local system, when a package is updated it is first removed, while leaving the data files in place, and then the new package is installed. If you purge a package it removes everything.