It is unfair, but not illegal. As a general matter, an employer is free to decide whom to interview for jobs, whether to post internally or only externally (or vice versa), whom to hire, etc. The only exceptions are if there is a contract (such as a union agreement) which specifies how jobs are to be posted or filled, or your personal right to apply for positions; and that employees may not discriminate in hiring against employees on the basis of protected characteristics, such as race, sex, religion, age over 40, or disability.