Spatially resolved near-infrared spectroscopy of NGC 6240