They tell people to empty stuff into a tray, but what is the point of putting notes such as travel money in there?
When I go through the full-body scanners in the US airports, they ask to completely empty my pockets because the machine will detect anything. I've tested this with banknotes, napkins, boarding passes, etc that I forgot in my pockets and was kindly patted in return when the machine put a red rectangle over that area of my body.
For metal detector (the good old magnetometer gates) paper in the pockets doesn't matter. Even smaller metal parts (like watches, belt buckles etc) often times wouldn't trigger it.
There might be differences between airports but in the airports I have been, no, not at all in pockets on your body.
My solution is to put everything in the pockets of my jacket and put that in the tray as is, so nobody sees what is in the pockets.
On the airport nearest me you can not even have a single paper hankie in your pockets.
There are systems which are less demanding but even then you rather have your money in something you trust rather than having to pull it out of your jeans pockets while some guards are watching every move you make.
Oh, it is not just airports, it is also the metal detector ports in some buildings. (I remember visiting the White House on a Washington DC bus tour and having chewing gum wrappers in my pockets. The guards were not amused.)
It is not the money they are interested in, it is that you do not bring anything through in your pockets that they do not allow, and the easiest way is to make sure you have no metal or even nothing in your pockets.
Are people allowed to keep cash in pocket when going through security?
That depends on the airport. E.g., typically not allowed at the main US airports, while some other airports do allow it.
Same for jackets, shoes, etc., security rules change quite a bit between airports/countries.
Rules may also differ for non-airport security checks (e.g., train).