answered my own question by doing some testing.
It looks like tags take preference in the sorting.
I recently encountered a situation similar to yours, but I saw that , to the contrary, tag sorting did not take preference over IP sorting (or seemed like it).
We have a newly built ePO 4.5 system. For two specific servers I have created tags, say, A and B by their IP address.
Then we created groups as well and some IP ranges were assigned in Group Details to sort nodes into those groups.
We created another specific group for these two servers and assigned these tags to the Group Details so the two systems had to sort into here.
Incidentally, the IP address of one of the two servers were not initially assigned within any of the IP ranges to other groups, so when the agent was installed on that server with tag A, it sorted into the specific group.
When we installed the agent onto the other server with tag B, it sorted into a different group, where the IP range have already contained its IP.
Desőite that the specific group for sorting based on tags preceded the other groups where IP sorting was defined.
So to me it seems that IP sorting takes preference over tag sorting.
How did you check your theory ?