Every train ticket in China is sold in the passenger's name, with their ID number. Foreign visitors buy with their passport, and show the same passport at the station gates and on the train.
Real tickets are sold at the station ticket windows, at machines, and through the official railway app and website, 12306. Sellers outside stations who offer special tickets with no queue and no passport are selling fake or overpriced tickets, or nothing at all.
If you lose your passport, you can't travel by train until you have a replacement document, so keep it safe.