If the company spent money to bring you in, interview you, take their personnel's time, etc, then I would say that you had a legit shot at the job and were beat out by another candidate.
Companies that post jobs and then hire inside candidates or that have chosen who they plan to hire generally don't waste time conducting interviews on other people other than the "preselected" individual. In that case, the job is theirs to lose and most other people only get as far as submitting an application.
My record for a rejection was 7 minutes once from the time I applied to the time I got the "thank you but this position was filled by a more qualified candidate" email. That type of response tells me that the company already had somebody in mind.