Given that after the mine went it's population was 250'ish it would have to be something like:
1) The Prussians allowed the casino to continue and it became a Monte Carlo of the north. During the wars it was taken by Germany, but returned to neutrality after the ceasefires.
2) The mine didn't run out until much later, by which time both countries where used to the microstate and it was able to replace the employment the mine brought with another industry (prehaps banking?)