Even if you pay a deposit for the glass, cup or other cutlerytableware, you are supposed to return it and get the deposit back. It does not entitle you to steal the cup, even if you forfeit the deposit by doing so. Deposit for cutlerytableware is quite common in Germany, not only at the christmas markets.
There are however usually several places to buy such cups as well, but expect them to cost more than what you pay as deposit.
Edit: Since I didn't expect it to be necessary to justify this answer, I didn't do so or link to any resources, but I seem to be mistaken. I thought it should be obvious what a deposit is and that paying a deposit does not entitle to keep the item. From a legal point of view, there is really no difference between paying a deposit for a wine cup or for a rental car and I also thought it should be obvious that you can not take into possession cutlerytableware, which you have provided when going out for something to eat or drink.
When I now google for the subject, it seems to be a common enough misconception, also among Germans, that you can keep cutlerytableware for which you have paid a deposit. It is a recurring subject in German law forums and even now and then a topic for newpaper articles. Even if two lawyers usually have three different opinions, they mostly agree on this topic: No, of course you can't keep anything for which you have paid a deposit. If you ask the persons running the booths or markets, their attitude usually lie somewhere between 'we can't prevent that customers take the cutlerytableware anyway' and 'if every customer would nick their cup, we would run out of cups three weeks before christmas'. Many christmas markets do not use generic cups, but have special yearly editions made. Even if the deposit is obviously higher than the production costs, you can not automatically infer that it is acceptable to keep the cup. A high deposit can also be used as a mean to get a higher return rate of the cutlerytableware. Even if it may appear that a booth operator earns money anyway if the cup is not returned for a high deposit, it may just as well mean that the operator will run out of cups and have no possibility to obtain more cups on a short notice.
Here is a seriously ment legal discussion on the subject (in German) about wether keeping the cup is to be concidered as larceny or embezzlement.
And no, I am not saying that you are likely sent to jail for stealing. Chances are very high that noone will notice or care. However if someone does, they are right and you are wrong. And yes, there is of course no law preventing you from asking the booth if you can keep a cup and they can then decide if it is ok or not.