Hamlet is in the midst of trying to prove or demonstrate his love for Ophelia. Others including his mother and Laertes mourn her too young death but Hamlet cries out that his love would outshine and outlast them all. He leaps into the grave to give action to his words that suggest he would gladly be buried alive with her and have the earth heaped so high upon them that it would be scorched by the sun.
He contends that even 40,000 brothers could not love her the same amount as he does, so go ahead, he shouts, bury me here with her, I'd gladly welcome that fate. More dramatic of course when he does so from in the hole with her!