When you run
PATH=abc:$PATH echo $PATH
or, in the more general case,
variable is set in environment of the
utility (but not in the current environment).
However, when your command line is parsed, the value of the
PATH variable is taken from the current environment.
You would have to set the variable in the environment where the variable is expanded. You may do this either either by separating it into two steps, as in
PATH=abc:$PATH; echo "$PATH"
which would set
PATH in the current environment and then execute
echo "$PATH", or set the variable for a child shell, as in
PATH=abc:$PATH sh -c 'echo "$PATH"'
which would set the
PATH variable within
sh -c, but not in the current shell.
In your second example,
PATH=/mybin:$PATH which python
which utility will probably say that
python is found in
/mybin since you modify
PATH in its environment. Notice how
PATH is never expanded in the current environment here, but internally by
which python is better (more portably) written
command -v python (see "Why not use "which"? What to use then?").
Just a quick reflection on your title, where you say "
ENV variable". The
ENV variable, even if this was not what you meant, happens to be an environment variable that some implementations of
sh (and some other shells) use. If its value is the name of a file, that file will be sourced before starting an interactive shell session.
bash has a
BASH_ENV variable which works the same way, but for non-interactive shells.