In Majora's Mask, you can buy anything when you currently have enough rupees. For that reason, if you withdraw enough rupees to be carrying 500, you can't buy the All-Night Mask until your rupee count finishes reaching 500. That glitch also works the other way. You can buy something if you currently have enough money to buy it even if you wouldn't have had enough money to buy it if you waited till your rupee count finished decreasing from your previous purchase. The rupee count decreases by 20 rupees per second. For each item in a shop item that costs at least 40 rupees, you can buy it more than once even if you don't have enough money to do so as long as you buy it fast enough. The less money you have, the faster you have to buy it up to the limit where you have so little money that it's impossible to buy it fast enough. Normally you can buy 10 bombs and 20 bombchus with 99 rupees but not if you never got bombchus before because when you buy the first 10 bombchus, it triggers a cutscene of Link holding a bombchu over his head, making you not have enough money to buy another 10 bombchus by the time that cutscene is finished. Unfortunately, when you make the All-Night Mask purchase, your rupee count goes down to 0 right away unlike the other shop purchases. Your rupee count also goes down right away when you deposit rupees.