No one knows what code you use to buy one, but to change one item to the Master Ball, use the following: 0101FDD5This will change your first item in the balls compartment to the Master Ball. For the second item, use 0101FFD5, and, assuming you know hexadecimal, the rest is easy. Should you not know how the Gameshark or hexadeciamal works, check the main pages.
To have infinite Master Balls, or whatever ball in your first slot, use 0163FED5. For the second slot, use 016300D6, and so on. Because the Gameshark modifies RAM, you can use the code 01xxFED5 (1st position), provided xx is between 02 and 63 (99 in base 10).
For balls other than the Master Ball, check with an item digits list to find Poké, Great, Ultra, Master, Lure, Love, Heavy, and other balls. You probably won't need those, but they're there.
------------------
"Knock knock"
"Who's there?"
"Someone who's too short to ring the doorbell."