You can use `xargs` or exactly this requirement. You can use the `-I` as place-holder for the input received from the pipeline, do
echo "myserver:${HOME}/dir/2/" | xargs -I {} rsync -r "{}" /local/path/
(or) use `~` without double-quotes under which it does not expand to the `HOME` directory path.
echo myserver:~/dir/2/ | xargs -I {} rsync -r "{}" /local/path/