Since we're afforded the yumminess that is regular expressions, we can simply specify that the trailing slash is optional with the question mark character (?). Also, will the varying values only ever be numbers? Or, would you like to only capture what's between sample/ and the next forward slash (if there is one)? I'm just asking because it's better to make the matching expression as specific as possible! At the moment sample/my/sub/domain.html would try to redirect to http://my/sub/domain.html.domain.com which I'm fairly sure you don't want.
Anyhow, to answer your question: RewriteRule ^sample/(.*)/? http://$1.domain.com [R=301,L]
The Following User Says Thank You to Salathe For This Useful Post: