Is the code you posted the entire plugin? Are you sure the paidsub_build hook is even getting executed? Where are you checking the "returned" value?
The only thing I can think of from what you posted is that the paidsub_build hook is in a function and the other hook isn't, so if you're trying to set a global you probably need to add a "global $sbpaid;" line (or else set an existing global instead).
Also, sometimes you can debug by echoing an HTML comment, like
Code:
echo "<!-- sbusergroups = $sbusergroups -->\r\n"
then view the page source.