Short answer: That "snapping back" usually happens when the Find My network can’t consistently pick up a fresh location for the AirTag, so the system falls back to your own device as the last known “contact” with it. Essentially, it’s telling you: “I haven’t heard from this AirTag in a while, so I’ll just show you where you are.”
A bit longer answer: It's important to understand that the Apple AirTag does NOT know its location. It has no means to do so. Instead, it relies on millions of other iPhones that are participating in Apple's crowdsourcing Find My network to relay the tag's encrypted ID, along with the phone's GPS location, to the Apple servers over the Internet. That is where you would see the tag's (the phone's) location in the Find My app on your iPhone.
When your phone is outside the Bluetooth range (~30-40') of your tag, there needs to be another iPhone nearby to pick up the tag's Bluetooth signal. To further make this difficult, placing the tag inside something will reduce the ability for that signal to be received by other iPhones.