The blame really rests on your domain name registrar.
Very little if no information is provided to unsuspecting customers. Registrars provide an extremely poor service at best. They should inform buyers that if they are going to use the domain for a website and for ranking purposes that search engines may see two websites instead of one and duplicate content penalties may result.
They are selling a product with no ingredients listed and no sell-by date. And with little or no aftersales customer service.
It is a known fact that google and other search engines apply penalties to duplicate content created by what you describe.
Google has at last applied a way for you to ask google to treat both versions as one. You will find the process in google's sitemaps.
How efficient this process is remains to be seen. Since very little that google claims it does very well is an efficient process. Some element of google misleading webmasters must always be in the back of your mind. For instance, google claims that no harm can come to your site from other webmasters. That is a lot of absolute rubbish. A registrar simply selling you a domain can have catastrophic affects on your website. You could easily purchase a duplicate content penalty from a registrar. But google would deny that too.
Alternatively, you can kill the root problem via your ANAME records. Again, if the registrar is properly equipped to allow you access to the records. You can point mysite123.com to www.mysite123.com this way the problem is solved permanently. All other methods, including serverside 301 are lesser options.
If you run your own apache based server, a simple container within your configuration files can hold the non www version. Insert in a folder with the same name a .htaccess file that gives a 301 permanent to the www version.