I have always understood the sail number country code to indicate the boat's country of registration (usually the nationality of the owner/skipper).
The exception I guess would be in the case of the events where the organiser supplies the boats for the event and the skippers put their country code on the boat they are sailing.