I came back from Germany almost a week ago. A friend of mine told me about this passport/identity card inspections by the police at train stations. He said this happens mostly for passengers of intercity trains.
I saw a bunch of German police on one platform at the Munich Hbf as I was getting to my train (different platform) to leave Munich. Wasn't stopped for inspection though.
On a related note, on a train from Basel, Switzerland to Freiburg, Germany, not all people's documents were inspected though the (presumably) border police looked at each passenger carefully. Mine wasn't checked, and I definitely don't look European. Train from Austria to Switzerland was another story. All passengers' documents were inspected by (presumably) Swiss border police.