File sharing is based on ordinary TCP/IP, so the rules are no different than those that apply to other network applications. Hostnames from UNC paths will always be resolved first using DNS or NetBIOS and then the traffic will sent out based on a routing table. Since it will resolve to a local address, the traffic will never go out, unless you have some very strange rules on a machine (I am not sure if it is even possible to create such a setup).
As for the speed, I am not so sure if it is smart enough not to use TCP/IP (even if packets never leave the machine) when connecting to a local address. If it does use TCP/IP, local file access will be faster as it does not have the network socket overhead. You can test this with a packet analyser, like Wireshark (see this link to see how to set up a capture on a local interface).