Clone object tag not working.

So i have it scripted so that the gamemanager spawns more ammoboxes as the game progresses. But for some reason the ammoboxes spawned by the gamemanager can’t be picked up, while if i manually place a prefab it works fine.

Code for gamemanager spawning ammoboxes:

    IEnumerator AmmoDrop()
    {
        if (Ammocount < wavenumber)
        {
            xPos = Random.Range(37, 130);
            zPos = Random.Range(0, 190);
            yPos = Random.Range(1, 1);
            Instantiate(Ammo, new Vector3(xPos, 2, zPos), Quaternion.identity);
            yield return new WaitForSeconds(2);

            xPos = Random.Range(-115, -20);
            zPos = Random.Range(0, 190);
            Instantiate(Ammo, new Vector3(xPos, 2, zPos), Quaternion.identity);
            yield return new WaitForSeconds(2);
  
        }
    }

Code for interacting with ammoboxes:

	if (Input.GetKeyDown(KeyCode.E))
		{
			RaycastHit hit;
			Ray forwardRay = new Ray(player.transform.position, transform.forward);
			if ((Physics.Raycast(forwardRay, out hit, pickuprange)) && hit.collider.CompareTag("Medipack"))
			{
				Destroy(hit.transform.gameObject);
				playerHealth.startingHealth = starterhealth;
			}
			if ((Physics.Raycast(forwardRay, out hit, pickuprange)) && hit.collider.CompareTag("Ammopack"))
			{
				if (gun.ammo <= gun.maxammo)
				{
					Destroy(hit.transform.gameObject);
					gun.ammo += ammopickup;
				}

				if (gun.ammo >= gun.maxammo)
				{
					ammomessage.SetActive(true);
					texttime = 0f;
				}
			}
		}

there is a chance that objects spawn with a different tag, so change their tag by the script.

     GameObject _ammo = Instantiate(Ammo, new Vector3(xPos, 2, zPos), Quaternion.identity);
    _ammo.tag = "Ammopack";

     //and check if tag works

    Debug.Log(_ammo.tag);