I could replicate the problem with various shells under FreeBSD, GNU/Linux, and Solaris. It had me head-scratching for more than an hour, so I decided to post the question here
I came up with a solution that doesn't hide the variable values in a subshell, and that can also work with multiple values.
set `echo foo bar` A=$1 B=$2