You seem to be asking two different questions here - "are they equivalent?" and "is CPU affinity inherited?".
First, the two commands you list are not equivalent. The first:
taskset 0x2 time echo "foo"
assuming a PATH and similar setup to the host I'm on at the moment, is equivalent to:
/bin/taskset 0x2 /usr/bin/time /bin/echo "foo"
Which produces a process tree like this:
/bin/taskset
|
\- /usr/bin/time
|
\- /bin/echo
The second:
time taskset 0x2 echo "foo"
which is equivalent to /bin/taskset 0x2 /bin/echo "foo" wrapped by the bash builtin time, produces this process tree:
/bin/taskset
|
\- /bin/echo
In this case, there are only two external processes - the time part is handled internally by bash instead of calling /usr/bin/time.
To answer your second question, CPU affinity is inherited in Linux, so your first example would bind both /usr/bin/time and /bin/echo to the specified CPU sets. In the second example, since time is the shell builtin, it would be influenced by any CPU affinity set on bash itself, not by the taskset in the current command line.