License of code accompanying a published article
Copyright only protects the expression of a work that is written down or otherwise placed in a "fixed medium." It does not apply to ideas or concepts. 

In the case of a published article where copyright is transferred to the publisher, that copyright only applies to the written content and images in the article. It doesn't apply to the concepts in it. 

If you write source code based on concepts described in a paper, you can apply whatever license you want to it - the copyright status of the paper is not relevant. (If the idea is patented, you may have to deal with that... but that is not related to copyright of the published article.)

See Does copyright protect the author's creative ideas? for more information.