From the Super Mario Wiki
The Digging Minigame is one of the minigames found in World-e in Super Mario Advance 4: Super Mario Bros. 3. It can be played in a Blue Toad House from the special world after collecting 30 Advance Coins. The player must pay 30 coins each time they play this game.
Mario starts the minigame in a cave, and two sections of digging earth (first seen in Super Mario Bros. 2). Mario must choose one of them and dig until fall to another level. There are more sections to choose (two for each previous section). Digging once more, Mario will fall to a small area divided into four areas. One of them contains a Treasure Chest, while the others are empty. If the player digs to the chest, he or she will get a random item, but loses if they reach an empty dead end.