because he is playing attention to the treat not your voice or command, hide te treat in your pocket or even leave it up high on the bench and ask your dog to do something,
your title said stay so if you are having trouble with that, you could try what i do, i put koda in a down or sit (whatever im asking for) and say stay but as i say stay i hold my open hand in front of her face to show her i have no treat so dont follow me when i walk away but when i come back a treat magically appears for her in my hand, they pick up on it pretty fast but also dont stay away for too long your dog will break before you go back, take small steps away first and wait then after awhile try longer