I was asked what the difference was between by and until and as a native speaker I was able to say whether the usage was correct or not, but could not really explain why. So here is the explanation.
Both words
until and
by indicate “any time before, but not later than.” But to understand the difference we need to distinguish between verbs that express continuous actions (stay, live, sleep etc.) and actions performed once (arrive, leave, finish etc.).
Use until (NOT by) with verbs that express continuity, as “be away” (stay in another place) does in the first sentence in the question. Until may be a preposition as in sentences (a), (b), and (c), or a subordinating conjunction, as in sentences (d) and (e):
| (a) | They lived in a small apartment until June 1998. |
| (b) | We're going to drive until dark. |
| (c) | Harry was so tired that he slept until noon. |
| (d) | The baby didn’t walk until he was 18 months old. |
| (e) | Did you really speak only French until you were ten? |
Use by (NOT until) with verbs referring to one action performed at a specific point of time, in affirmative sentences and in questions. “Be back” (return to the original place) is an example of this kind of verb in the second sentence in the question. Here are other examples:
| (f) | You have to finish by August 31. (August 31 is the last day you can finish; you may finish before this date.) |
| (g) | Jack had left his office by 5:15, so he didn't know about the burglary. (Jack left his office at some time before 5:15 or at 5:15. 5:15 is the last possible time he could have left.) |
| (h) | If the plane arrives by noon, we'll have lunch at the new restaurant near the airport. (The plane will have arrived at some time before noon, or at noon at the latest.) |
| (i) | Do we have to pay our taxes by April 15? (Is April 15 the last date when we can pay our taxes?) |
However, with negative verbs referring to a point of time, we can also use until. Sentences (f) through (i) are changed to their negative forms in (j) through (m) below, and may also take until, with a slightly different meaning:
| (j) | You don't have to finish until August 31. (You can stay in the situation of not having finished for all the time up to August 31, but that is the last day you will have to finish.) |
| (k) | Jack didn't leave his office until 5:15, so he knew about the burglary. (Jack stayed in the situation of not leaving his office during all the time before 5:15, but at 5:15 he left the office) |
| (l) | Even if the plane doesn't arrive until noon, I'll still be there. (The plane is in the air, and might arrive at noon, not before.) |
| (m) | We don’t have to pay our taxes until April 15. (We don’t have to pay our taxes for all the time before April 15; on April 15 the situation changes, and we have to pay our taxes.) |
The information is taken from the website
http://www.pearsonlongman.com/ae/azar/grammar_ex/message_board/archive/articles/00016.htm