In Germany, not having obtained a valid bus ticket is not a misdemeanor but a crime under § 265a StGB. In general, such a person is obligated to pay an increased transport fee of 60€ or double fare if that is higher (§12 EVO / §9 VO-ABB). Note that the fee is bound to not having obtained. If you have a previously bought ticket for a week with your name on it but forgot it at the hotel, you don't break the law, you just couldn't show it and thus might need to show it to the bus station later and pay a small service fee, at which point the increased transport fee is moot.
If you don't pay on the spot, they want to see your ID and if you refuse, call Police to do the identification for them - your personal information will be kept so in case you don't pay within the specified time, they could start with the legal processes as well as spot repeat violators.
If you don't pay up or they repeatedly pick you up without a ticket, they can (and for residents of germany most likely will) file suit and the case ends in front of the judge and then can lead to a proper, but higher, fine, or up to one year in prison.
If you are a tourist and don't pay, the case might get tried in absentia and you will get sent the higher fine and possibly a bill for some additional fees per mail. At that point, the transport company has a valid title that says you owe them and they can either request your country's authorities to assist or send a debt collection agency after you or ask the police of your country to assist.
However, the ticket inspectors are known to show quite some leniency on tourist non-residents (german tourists don't get that) when it comes to bus tickets, letting them off with a stern warning and explanation how the ticket system works here.