The ghost's functions in Act I, scenes ii and iv, are related to its function in Act I, scene i. In that first scene the ghost's appearance sets the action in motion for the entire plot. Horatio and the others see the ghost and are greatly disturbed by it. (In the Shakespearean world, a disruption or oddity in one realm is echoed in another. If a ghost shows up somewhere it isn't supposed to be, there's a problem somewhere else, specifically the realm of the living, especially Denmark.) In scene ii accounts of the ghost are brought to Hamlet; here its functions are to put the burden of fixing things on Hamlet, and to undercut Claudius' big speech opening scene ii. Scene iv finishes this "anointing"—Hamlet sees the ghost and realizes just how much is wrong.
Is the second question why didn't Shakespeare let this happen? If so, I'd say it is to allow Hamlet's emotions to build, and the audience's suspense along with it.