We do not know or can confirm his rejection was due to * reference to section 12 (2) of the immigration Act.
He .. the OP was not asked for $500 at any time by any IO.
He .. the OP just quoted this in his thread for whatever reason which is a stupid thing to say.
OP .... you were rejected because this is your 3rd entry into Thailand on either a TV or Visa on arrival.
You raised a red flag when trying to enter at Poi Pet as this is your 3rd entry.
You should have done your homework and entered at a more favorable entry point or acquired the agents services to assist in your entry process.
You only have yourself to blame ..... as others have mentioned, have 20,000 baht in cash, exit ticket or whatever is needed to minimise another rejection.
obviously you haven't learn't how Asia works, you get what you pay for.