This is why the Guru thread needs to always be on page 1... this was answered there.
The Pokemon is digitized and its sentience file is inserted into a virtual reality world. The Pokemon knows that it's in a Ball, the same way you know you're in a VR machine. The VR world is customized to reflect the stats of the Pokemon inside (for example, a desert VR area for a Cacturne as opposed to an ocean). Luxury Balls have the same base VR capacity, but with added perks: toys, flashy lights, etc.
Pokemon neither turn into energy nor do they shrink: they are digitized (conversion of matter into computer data). This theory is supported by the presence of the Pokemon Porygon and the Pokemon PC system, which turns both Pokemon and items into data.
One of many posts regarding the explanation
here.