If a phrase combines to have a meaning different from the dictionary definition of the words, it has an idiomatic meaning. We can say that something is in the bag and mean that it is a certainty- we are not literally talking here about something in a bag.