>>35430764In the anime light novel manga thingy, it was confirmed how pokeballs work in the anime universe. (at least originally) Essentially pokeballs aren't any marvel of technology or anything, they're just hollow balls with mirrors in them. Pokemon for whatever reason when they become subdued they can turn into energy and be trapped inside an object. e.g. a pencil case. This often leads to the pokemon dying due to the energy dissipating. it wasn't long before scientists discovered that for whatever reason mirrors could reflect this energy and keep it active in the dark so they created Pokeballs and made it illegal to capture pokemon with anything other than pokeballs.
TLDR It's not the pokeballs that capture Pokemon, it's the pokemon's DNA that transforms them into energy when they are weak or tired