Magento by default doesn't use 301 permanent redirection when redirecting website from non-www to www or www to non-www. It instead uses 302 temporary move. If you are looking for SEO benefit or get higher rankings on google, always use www or non-www version of your website otherwise your website will be penalize by google search engine, bing search engine and others as well.
So, how can you configure your website to use 301 permanent redirect instead of 302 temporary move?