Back at Botcon, the writers said at one of their panels that the reason the cube made evil TF's was because all of Earth's technology was reverse engineered from Megatron, and thus any TF's created from it would be evil, like Megs. However, in an interview posted over at tfw2005, it looks like Roberto Orci has changed his answer. Here's a quote:
How come the Allspark created TFs were all Decepticons?
Prime intended to use the Allspark to repower Cybertron as it was intended. Megatron wants to abuse it by creating Transformers directly, which makes souless, primal Transformers.
So maybe that's the official answer now. Or maybe there isn't one. Or maybe the sequel(s) will explain it officially. Or maybe it's just a goof up and I'm gonna give up trying to figure it out.
Regardless, maybe this might at least curb the stream of new threads asking this question.