This is something that has gone on for many years. There might not be a written law but there are several unwritten ones to do with recruitment and employment agencies, finder's fees etc. In many cases these become formal agreements and they can be considered as contractual obligations.
In the late eighties we had the situation, already described above, where we (the dozen or so sub-contractors) were invited to join the permanent staff, of a major international aerospace company for which we already worked, to do the same job that they paid us for by the hour via an employment agency. We were told initially that employment was assured as most of us had proved our worth over a period of time.
A couple of days later however we were told that the jobs would now have to be advertised in the national papers to avoid ill feeling among the employment agencies. Since these agencies are a major resource for companies of this stature, it was agreed that we all had to apply as if we weren't already employed to avoid the company being accused of poaching by the agencies. It was a formality however and the company interviews were very brief. The vacancies were mostly filled with experienced sub-contractors such as myself.
I stayed as a sub-contractor for the money. I wasn't bothered by job security so much at that time. Even with a mortgage, I was assured work anywhere in the world with my qualifications. Now of course, there aren't any jobs for life whether you are paid by the company you work for or by their agent. You are probably as secure working as a sub-contractor as you would be working as an employee in many cases
What with Internet recruitment policies and such, I bet it's even more of a minefield.
I'm happy to call myself semi-retired.
@ped; I'm sorry you suffered a sort of non-rejection Dear John letter. It's hard to know how to file that one.