When you read a price, the word "dollar" (or substitute any type of currency) comes after the amount. e.g. "This pineapple costs four dollars."
When writing a price symbolically, I say you should follow the same structure as when spoken. Thus, "This pineapple costs 4$."
The traditional way of writing said sentence would be, "This pineapple costs $4," which would logically be spoken, "This pineapple costs dollars-four," and we obviously don't speak like that!
There are lots of illogical things in the English language, and I'd be inclined to let this particular one slide, except that it introduces even more complications when working with big numbers.
Consider the following sentence: "The construction is projected to cost six-hundred-million dollars."
Naturally, you don't want to have to write out all those words, so numerals and symbols come to the rescue! A newspaper might write out that sentence as "The construction is projected to cost $600 million." Now, because of the grouping of numbers and the separation of the word million, it is very easy to misread that sentence as "...to cost six-hundred dollars...million...Oh, I mean six-hundred-million-dollars." Having to reread a sentence is a minor inconvenience, but becomes more than an inconvenience when you're only skimming the sentence, just see the numbers (because they are logically grouped and also larger than your typical letters, they stand out) and get a completely inaccurate notion of the real price. All this trouble could be avoided entirely by reordering the words to "600 million $"—a bit odd-looking, but only because you're not used to that construction.
I've been annoyed by this backwards representation of numbers enough times that I vowed to do something about it. Granted, I have little clout in the evolution of language, but I will still try to make a contribution! You don't have to follow my system, but if it makes sense to you, maybe you should! It only takes a spark to get a fire going. Maybe, one day, everyone will follow this syntax...but until then, at least you know why I do.