Spy Hats Glitch

So i entered the game in offline mode and the spyhats were costing 500BP's each, but the game do not allow me to buy them without internet connection, and even when i turned on the wi-fi it still not possible to buy them, i saw many people are able to use a certain glitch to buy them withou speding their gems in the tower. How is it possible?