This is called a chosed-plaintext attack and its effectiveness depends on the algorithm in question.
An example of a cryptosystem that can be broken very easily in this way is a (poorly implemented) one-time pad. This cryptosystem can be implemented as follows: take your plaintext. Then generate a "key", which is a string of random symbols equal in length to your plaintext. To encrypt, XOR the plaintext with the key, symbol-by-symbol. Now, if you have a copy of the encryption machine and want to reverse-engineer the key using a chosen-plaintext attack do the following: choose a plaintext and encrypt it. Then XOR the resulting ciphertext with the plaintext you put in. The result will the key inside the machine. This is why proper implementations of a one-time pad only ever use a given key once.
An example of a cryptosystem that is specifically built to withstand chosen-plaintext attack is any public-key cryptosystem. Public key systems work by separating the encryption key from the decryption key, so you can publish the encryption key to allow others to encrypt info and send it to you, while keeping the secret key secret so that no one can decrypt it. The issue here is that anyone can now do the encryption (since the encryption key is published), so chosen-plaintext attacks are unpreventable. Public key systems must therefore be resistant to these types of attack.
Most (if not all) ransomware uses block ciphers such as AES 3DES, 3fish, etc. Some papers have been published about theoretical chosen-plaintext attacks on weakened versions of these algorithms which make some reduction to attack time, but even these theoretical attacks on non-existent weakened versions of these algorithms result in attack times longer than the remaining life-expectancy of the sun.
yes, but takes time...
break
that encryption means to retrieve the key and probably derive its algorithm so that we can crack the ransomware.