Is the gray matter inside of the spinal cord but outside of the brain?

Almost correct. The gray matter (nervous system tissue with cell bodies) is inside the cord, surrounded by white matter (axons: nerve fibers going to & from the brain). While there is gray matter on the surface of the brain, it is also present in collections deep inside the brain. The organization of the central nervous system is quite complex.