apiece is an adverb. An adverb modifies either a verb, an adjective, or another adverb.
adverbs in the sentence: apiece
adjectives in the sentence: one
verbs in the sentence: cost
'apiece' does not modify itself. So we have narrowed the circle down to two words: one, cost. (Apiece X) dollar? No. Cost (X) apiece. 'apiece' modifies 'cost'.
QED.