Why is "of" present for "out of stock" but not "in stock"?
Solution 1:
It's because "in" is a preposition, while "out" is not*. In your examples, "out" is being used as an adjective or an adverb.
To have a true opposite for the phrase "in X", we need another prepositional phrase. Some languages have a single word for "out of" (the example that comes to mind right now is Latin, where "ex" means "out of"). But in English, we don't have a single-word opposite for "in". Sometimes we juxtapose the words "in" and "out" and treat them as opposites, but this is usually when they are directional adverbs (go in the door, go out the door) rather than prepositional states of being (in the room, out of the room).
So we say "out of X" simply because we would never* say "out X" and we don't have a word for "ex X" like in Latin.
Perhaps if you are craving some extra parallelism in your prepositional phrases, you could start using "into" as an opposite for "out of". While "into" has a slightly different meaning than "in", it could make for some semantically interesting examples!
- into jail (upon initial incarceration)
- into service (immediately after successful repairs?)
- into time (...??)
EDIT: I forgot to mention, in many (most?) cases, "out" is usually analyzed as an adverb. "We ran out of milk." could be abbreviated as "We ran out." This shows that "out" is describing the verb "ran", instead of being inherently tied to the preposition "of".
*Please don't misunderstand what I'm saying! It is in fact possible to use "out" as a standalone preposition, meaning something like "through". Using "out" as a preposition used to be more common than it is today. In 1830, Alfred, Lord Tennyson wrote in "Adeline": "Thy roselips and full blue eyes / Take the heart from out my breast."
Nowadays the use of "out" as a preposition is more restrictive to certain phrases, for example "walk out the door" or "look out the window", and almost exclusively means "through". In contrast, today we would say "take the heart from out of my breast".