What is the term for using a word to portray a particular idea outside of but close to the context of the original meaning? Here is an example of what I mean. Someone may use the word “mercenary” in a sentence, to describe agency working, working for several different people or picking up lots of different jobs as the need arises. Using the word “mercenary” in this way, is close to the original meaning of a soldier being hired by foreign armies.
Here is another example - someone may use the word “gerontocracy” in a sentence to describe a school or a company that is run by people who have been in positions of leadership for a very long time. Using the word “gerontocracy” in this way is close to the original meaning of a government being run by elders.
Here are two sentences - (1) “I’m looking forward to the interviews this afternoon, we may get some younger applicants who can infiltrate this gerontocracy” (2) “I’m a mercenary at the moment, just freelancing, I do work for a lot of different people”
Is there a literary term that describes the use of words in the way that I have described above?