On one show of this type, probably Judge Rinder, two friends hatched a story just to get on the show. As well as being paid to appear plus expenses including hotel and travel, they split the award between them. Easy money, I suspect they are not the only ones to do it.
In Judge Judy some of the cases are found by researchers going through old real court cases. If they think it would make good TV they contact the parties involved and ask them to rehash their case in front of Judy, for financial reward obviously.
It's cheap TV that many find entertaining.