You don't need to transform the hit to a position, just use hit.point, so
Code:
if (GUI.Button(new Rect(230, 190, 80, 20), "Test"))
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit, distance))
{
SpawnItems.spawnItem(Convert.ToInt32(this.itemspawn), Convert.ToInt32(this.amount), hit.point);
}
}
Only problem with this being a button is that, your cursor is over the button when you press it, so it would spawn behind your mouse on the screen, so unless your looking at the ground it wouldn't spawn.