The use of lay prosecutors in court cases with passengers accused of not buying the correct ticket is not legal, firms were told.