Depends on the state and their filing requirements. There's usually a filing fee, although some states allow someone to appear on the ballot with a number of signatures (of registered voters) gathered. I've heard of people who simply had their names placed on a ballot but made no attempt to campaign.
There were some real sideshows too, such as California's Governor recall of 2003. There were two "races", plus a couple of ballot proposition that qualified and that they put on the ballot rather than waiting for the next election. One race was a yes/no question on whether or not Governor Gray Davis should be recalled. Then there was the simultaneous race for a replacement should the recall occur. There was a $3500 filing fee (with a requirement for 65 signatures of registered voters) or a requirement for 10,000 signatures without a filing fee. The filing fee was prorated depending on how many signatures were gathered in lieu of the filing fee. Several actors were on the ballot, including of course Arnold Schwarzenegger and Gary Coleman. If you look at the ballot, there were some interesting jobs, such as "Adult Film Actress" and "Entertainer". Larry Flynt used "Publisher".