The fine/extra fee for purchasing a ticket on long-haul trains is now 90 CHF. Probably best to get one either from a ticket office or a ticket machine in advance

. The ticket machines speak English and take credit cards.
Note there are Apps which allow you to purchase electronic tickets and store them on your smartphone (definitely exists for iOS and Android). However, you really want to have completed the purchase before the train starts moving - there was a story of someone who got checked whilst making the purchase and he ended up paying the fine.
On local trains, you don't have a choice, you must have a ticket. However, I doubt this will get you a criminal record, at least not the first time.