The point is that each time you start a new program, normally it starts a new sub-shell to run it in.
Shell env vars can only be exported (passed) downwards, not up, so when the sub-shell exits (completes), it's entire env, inc (sub-shell) vars disappears.
However, if you
(both do the same thing), then the scriptB.sh is run as if you had added the code directly into the caller prog (scriptA.sh), so created vars are retained in the scriptA.sh env.
Read this: http://www.tldp.org/LDP/abs/html/subshells.html