The Screen Actor's Guild sets certain required pay scales for actors. In some cases actors will agree to pay adjustments or a lack of credit as a favor to a friend directing the film (Robin Williams in Baron Munchausen) or just to have the chance to cameo in the film for fun. In some cases an actor won't be billed so as not to spoil a surprise. Lately the Marvel films (Avengers, Iron Man, etc) have been not billing cameo actors for this reason.
Lastly, in some cases its a gross oversight. James Earl Jones had to wait decades for the digital reissue of Star Wars to get screen credit as the voice of Darth Vader.