That's a line from a song. You can understand it to mean
One (is sold for) a penny, two (are sold for) a penny, (I'm singing about) hot cross buns.
Songs, like other forms of poetry, don't follow grammatical rules.
Use "only" as close to the thing you want to modify. If you write a few sentences using it, we can take a look at your placement.
[a writer, not a teacher]